@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-companion-discovery.js","sourceRoot":"","sources":["../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,mCAAmC,GAIpC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAExF;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,6BAeX;AAfD,WAAY,6BAA6B;IACvC,sGAAsG;IACtG,oDAAmB,CAAA;IACnB,mDAAmD;IACnD,oDAAmB,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AC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;AAChD,CAAC;AAED,SAAS,eAAe,CACtB,SAA8C;IAE9C,OAAO,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { createRequire } from 'node:module';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport {\n ProviderCompanionContributionSchema,\n type ProviderCompanionContribution,\n type ProviderCompanionRuntimeTarget,\n type RuntimeOwnerCompanionExports,\n} from '@wildo-ai/saas-models';\nimport type { WildoSaasConfig } from './define-saas-config';\nimport { loadPackageCompanionExport, resolvePackageCompanionEntryPath } from './loader';\n\n/**\n * `providerPackage` was added by #330 and is the point of that slice on this file.\n *\n * The other four owner kinds are RUNTIME OWNERS declared in `wildo.saas.config.ts` — an application's\n * own services, libraries, minions and workers. Walking only those is what made a provider shipped as\n * its own npm package invisible to discovery (audit finding PL-1): the package is a DEPENDENCY, not a\n * runtime owner, so nothing ever asked it what it contributes, and an application had to hand-author a\n * contribution for a provider whose own package already knew everything about it.\n */\nexport enum ProviderContributionOwnerKind {\n /** A service package declared in `wildo.saas.config.ts` — the application's backend or a frontend. */\n SERVICE = 'service',\n /** A shared library package of the application. */\n LIBRARY = 'library',\n /** A minion runtime, keyed by its minion name. */\n MINION = 'minion',\n /** A Node worker runtime, keyed by its worker name. */\n WORKER = 'worker',\n /**\n * A provider shipped as its own npm package (#330) — a DEPENDENCY rather than a runtime owner,\n * which is why it needed its own walk and its own member. The value stays camelCase because it is\n * substituted into operator-facing diagnostics beside the four above.\n */\n PROVIDER_PACKAGE = 'providerPackage',\n}\n\n/**\n * Package-name prefixes whose dependencies are treated as provider packages.\n *\n * `@wildo-ai/provider-` is the framework convention (#337 D3). An application's OWN provider packages\n * are admitted through the scope of its root manifest — an application published as `@acme/…` gets\n * `@acme/provider-…` for free — so a private provider needs no configuration to be discovered, and a\n * dependency belonging to somebody else's scope is never executed by this walk.\n */\nexport const FRAMEWORK_PROVIDER_PACKAGE_PREFIX = '@wildo-ai/provider-';\n\n/**\n * The framework's own scraped catalogue, admitted by exact NAME because it does not fit the prefix.\n *\n * Paul decided on 2026-09-06 that the transposed catalogue ships as ONE package with a subpath per\n * vendor — `@wildo-ai/providers/slack` — rather than as 697 packages. The prefix above predates that\n * decision and describes the shape it replaced, and `'@wildo-ai/providers'.startsWith('@wildo-ai/provider-')`\n * is **false**: the `s` is not a `-`.\n *\n * So discovery could not see the catalogue at all. What it DID admit, measured 2026-09-07, was\n * `@wildo-ai/provider-simulators` — the test doubles — and nothing else in the repository matches the\n * prefix. A rule that admits only the simulator of a thing is worse than no rule, because it looks\n * like coverage.\n *\n * An exact name rather than a loosened prefix (`@wildo-ai/provider`, no hyphen) on purpose: that\n * would also admit any future `@wildo-ai/providerfoo`, and the catalogue is ONE known package, not a\n * family. The prefix keeps serving the family it was written for — an application's own\n * `@acme/provider-thing`.\n */\nexport const FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE = '@wildo-ai/providers';\n\n/**\n * The ENGINE's own provider barrel, admitted exactly as the catalogue is.\n *\n * The engine ships 23 providers and exports them through `./companion` — the same shape every\n * provider package uses. Discovery did not admit it, so an application that wanted `resend` declared\n * it THREE times: the scope, a hand-authored `provider-contributions.ts` projecting the engine's own\n * metadata back at it, and the package dependency. The middle one carried no information the other\n * two lacked; config sync refused a scoped-but-uncontributed provider, so it was not optional either\n * (#358).\n *\n * A NAME rather than a prefix, for the reason the catalogue's own note gives: this is one known\n * package, not a family.\n */\nexport const FRAMEWORK_ENGINE_PROVIDER_PACKAGE = '@wildo-ai/external-connectors-private';\n\ninterface ProviderContributionOwner {\n kind: ProviderContributionOwnerKind;\n key: string;\n packageRoot: string;\n}\n\ninterface ProviderContributionTarget extends ProviderContributionOwner {\n ownerLabel: string;\n}\n\nexport interface DiscoveredProviderCompanionContribution extends ProviderCompanionContribution {\n owner: ProviderContributionOwner;\n}\n\nexport interface DiscoverSaasProviderCompanionContributionsResult {\n contributions: DiscoveredProviderCompanionContribution[];\n}\n\n/**\n * The runtime targets an application's SCOPES imply for one provider ref.\n *\n * ## Why a package's declared targets cannot be the answer\n *\n * A provider PACKAGE is shipped once and installed by many applications, so it cannot know any of\n * their runtime topologies. Measured 2026-09-09: all 682 catalogue vendors declare\n * `[{ kind: 'backend' }]` and every engine contribution declares `backend` (plus `companion` for the\n * model-ish ones). Those are defaults standing in for an answer the package is not able to give —\n * a minion key or a worker key exists only in `wildo.saas.config.ts`.\n *\n * The consequence was latent rather than theoretical: a CATALOGUE provider scoped to a minion would\n * have failed materialization with \"no discovered contribution supplies its secret-contract shape\n * for this runtime\", because the package declares a `backend` target and the minion scope looks for\n * a `minion` one. No application had scoped one to a minion yet, so nothing had reported it.\n *\n * ## Why the scopes ARE the answer\n *\n * `providers.scopes` is where an application says which runtimes reach which provider — it is the\n * same decision, already authored, in the place the runtime artifact is built from. Measured against\n * Wonder Todos' hand-authored projections: the scopes reproduce 9 of 10 target sets EXACTLY, and the\n * tenth is a SURPLUS (a `companion` target for a provider the companion scope does not name) which\n * the artifact discards anyway, since it is built from scope INTERSECT contribution.\n *\n * So nothing is lost by deriving, and what is gained is that an application declares a provider once.\n *\n * Applies to contributions discovered from a PACKAGE. A runtime owner's own companion barrel keeps\n * whatever it declares: that is the application's own file talking about itself, and an application\n * package is entitled to state a target the scopes do not.\n */\nfunction resolveScopeImpliedRuntimeTargets(\n providerRef: string,\n saasConfig: Pick<WildoSaasConfig, 'providers'>,\n): ProviderCompanionContribution['runtimeTargets'] {\n const scopes = saasConfig.providers?.scopes;\n if (!scopes) return [];\n const targets: ProviderCompanionContribution['runtimeTargets'] = [];\n\n if (scopes.backend?.providers?.[providerRef]) targets.push({ kind: 'backend' });\n if (scopes.companion?.providers?.[providerRef]) targets.push({ kind: 'companion' });\n for (const [minionKey, scope] of Object.entries(scopes.minions ?? {})) {\n if (scope?.providers?.[providerRef]) targets.push({ kind: 'minion', minionKey });\n }\n for (const [workerKey, scope] of Object.entries(scopes.workers ?? {})) {\n if (scope?.providers?.[providerRef]) targets.push({ kind: 'worker', workerKey });\n }\n return targets;\n}\n\nexport async function discoverSaasProviderCompanionContributions(input: {\n saasRoot: string;\n saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>;\n}): Promise<DiscoverSaasProviderCompanionContributionsResult> {\n const contributions: DiscoveredProviderCompanionContribution[] = [];\n\n const runtimeOwnerTargets = resolveContributionTargets(input.saasRoot, input.saasConfig);\n\n for (const target of [\n ...runtimeOwnerTargets,\n ...resolveProviderPackageTargets(input.saasRoot, runtimeOwnerTargets),\n ]) {\n const companionExports = await tryLoadRuntimeOwnerCompanionExports(target.packageRoot);\n if (!companionExports) {\n continue;\n }\n\n const parsedContributions = ProviderCompanionContributionSchema.array().parse(\n companionExports.providerContributions ?? [],\n );\n\n // A PACKAGE cannot know this application's runtime topology, so its declared targets are a\n // default and the SCOPES are the answer. A runtime owner's own barrel keeps what it declares —\n // see `resolveScopeImpliedRuntimeTargets`.\n const derivesTargetsFromScopes = target.kind === ProviderContributionOwnerKind.PROVIDER_PACKAGE;\n\n contributions.push(\n ...parsedContributions.map((contribution) => ({\n ...contribution,\n runtimeTargets: derivesTargetsFromScopes\n ? resolveScopeImpliedRuntimeTargets(contribution.ref, input.saasConfig)\n : contribution.runtimeTargets,\n owner: {\n kind: target.kind,\n key: target.key,\n packageRoot: target.packageRoot,\n },\n })),\n );\n }\n\n return { contributions };\n}\n\n/**\n * Walk an application's provider contributions and VALIDATE them — one step, because the two must\n * never come apart (#334).\n *\n * The walk was already shared; what was duplicated is the PAIRING. `wildo config sync` and\n * `wildo lock check` each called the walker and then, separately, the validator — and the validator\n * sits outside the walker, so a consumer that forgot it would compute a lockfile section from\n * contributions nobody had checked against the authored scope. Three correct call sites with nothing\n * making a fourth correct is the shape `.claude/rules/invariant-call-site-enumeration.md` is about.\n *\n * The caller still LOADS the config. That is deliberate rather than an omission: loading is one line\n * each caller already owns with its own error handling, it is not the part that can silently come\n * apart, and folding it in here would put the load behind a seam that the sync service's own tests\n * mock — `loadSaasConfig` mocked as a module export is not seen by a caller INSIDE this module, so\n * those tests would have had to mock this function instead and would then no longer exercise the real\n * discovery and the real validation they exist to check.\n */\nexport async function resolveValidatedSaasProviderContributions(input: {\n saasRoot: string;\n saasConfig: Pick<WildoSaasConfig, 'modules' | 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>;\n}): Promise<DiscoveredProviderCompanionContribution[]> {\n const { contributions } = await discoverSaasProviderCompanionContributions(input);\n validateDiscoveredSaasProviderContributions({\n saasConfig: input.saasConfig,\n discoveredContributions: contributions,\n });\n return contributions;\n}\n\nexport function validateDiscoveredSaasProviderContributions(input: {\n saasConfig: Pick<WildoSaasConfig, 'modules' | 'providers' | 'services' | 'minions' | 'workers'>;\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n}): void {\n const { saasConfig, discoveredContributions } = input;\n const errors: string[] = [];\n const declaredModuleIds = new Set(Object.keys(saasConfig.modules ?? {}));\n const declaredServiceKeys = new Set(Object.keys(saasConfig.services ?? {}));\n const serviceKeyToFrontendType = new Map<string, string>(\n Object.entries(saasConfig.services ?? {})\n .filter(([, definition]) => definition.frontendType !== undefined)\n .map(([serviceKey, definition]) => [serviceKey, definition.frontendType as string]),\n );\n const declaredFrontendServiceKeys = new Set(serviceKeyToFrontendType.keys());\n const declaredFrontendTypes = new Set(serviceKeyToFrontendType.values());\n const declaredMinionKeys = new Set(Object.keys(saasConfig.minions ?? {}));\n const declaredWorkerKeys = new Set(Object.keys(saasConfig.workers ?? {}));\n\n for (const contribution of discoveredContributions) {\n if (contribution.sourceModuleId && !declaredModuleIds.has(contribution.sourceModuleId)) {\n errors.push(\n `${describeContribution(contribution)} references sourceModuleId \"${contribution.sourceModuleId}\" ` +\n 'but that module is not declared in wildo.saas.config.ts.',\n );\n }\n\n const dependencyNames = readRuntimeReachablePackageNames(contribution.owner.packageRoot);\n const runtimePackageName = extractPackageName(contribution.runtimeImportPath);\n if (!dependencyNames.has(runtimePackageName)) {\n errors.push(\n `${describeContribution(contribution)} declares runtimeImportPath \"${contribution.runtimeImportPath}\" ` +\n `but ${contribution.owner.kind} \"${contribution.owner.key}\" does not depend on \"${runtimePackageName}\".`,\n );\n }\n\n for (const target of contribution.runtimeTargets) {\n switch (target.kind) {\n case 'frontendService':\n if (!declaredFrontendTypes.has(target.serviceType)) {\n errors.push(\n `${describeContribution(contribution)} targets frontendType \"${target.serviceType}\" ` +\n 'but no service with that frontendType is declared in wildo.saas.config.ts.',\n );\n } else if (!contribution.frontendEntry) {\n errors.push(\n `${describeContribution(contribution)} targets frontendType \"${target.serviceType}\" ` +\n 'but does not provide a frontendEntry payload for bootstrap materialization.',\n );\n }\n break;\n case 'minion':\n if (!declaredMinionKeys.has(target.minionKey)) {\n errors.push(\n `${describeContribution(contribution)} targets unknown minion \"${target.minionKey}\".`,\n );\n }\n break;\n case 'worker':\n if (!declaredWorkerKeys.has(target.workerKey)) {\n errors.push(\n `${describeContribution(contribution)} targets unknown worker \"${target.workerKey}\".`,\n );\n }\n break;\n case 'backend':\n case 'companion':\n break;\n }\n }\n }\n\n const runtimeScopes = saasConfig.providers.scopes;\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: 'backend',\n providers: runtimeScopes.backend?.providers ?? {},\n matchesTarget: (target) => target.kind === 'backend',\n });\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: 'companion',\n providers: runtimeScopes.companion?.providers ?? {},\n matchesTarget: (target) => target.kind === 'companion',\n });\n\n for (const [serviceKey, scope] of Object.entries(runtimeScopes.frontendServices ?? {})) {\n if (!declaredServiceKeys.has(serviceKey)) {\n errors.push(`Provider scope references unknown frontend service \"${serviceKey}\".`);\n continue;\n }\n if (!declaredFrontendServiceKeys.has(serviceKey)) {\n errors.push(\n `Provider scope references non-frontend service \"${serviceKey}\". ` +\n 'Only services with a frontendType may appear under providers.scopes.frontendServices.',\n );\n continue;\n }\n const serviceType = serviceKeyToFrontendType.get(serviceKey);\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `frontendServices.${serviceKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'frontendService' && target.serviceType === serviceType,\n });\n }\n\n for (const [minionKey, scope] of Object.entries(runtimeScopes.minions ?? {})) {\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `minions.${minionKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'minion' && target.minionKey === minionKey,\n });\n }\n\n for (const [workerKey, scope] of Object.entries(runtimeScopes.workers ?? {})) {\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `workers.${workerKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'worker' && target.workerKey === workerKey,\n });\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Provider companion-export discovery validation failed:\\n- ${errors.join('\\n- ')}`,\n );\n }\n}\n\nfunction resolveContributionTargets(\n saasRoot: string,\n saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>,\n): ProviderContributionTarget[] {\n const shouldIncludeBackendServices = hasAnyProviders(saasConfig.providers.scopes.backend?.providers);\n const frontendServiceProviderScopes = Object.entries(saasConfig.providers.scopes.frontendServices ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([serviceKey]) => serviceKey);\n const minionProviderScopes = Object.entries(saasConfig.providers.scopes.minions ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([minionKey]) => minionKey);\n const workerProviderScopes = Object.entries(saasConfig.providers.scopes.workers ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([workerKey]) => workerKey);\n\n return [\n ...Object.entries(saasConfig.services)\n .filter(([key, definition]) => (\n definition.frontendType\n ? frontendServiceProviderScopes.includes(key)\n : shouldIncludeBackendServices\n ))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.SERVICE,\n key,\n ownerLabel: `service \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.libraries ?? {}).map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.LIBRARY,\n key,\n ownerLabel: `library \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.minions ?? {})\n .filter(([key]) => minionProviderScopes.includes(key))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.MINION,\n key,\n ownerLabel: `minion \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.workers ?? {})\n .filter(([key]) => workerProviderScopes.includes(key))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.WORKER,\n key,\n ownerLabel: `worker \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ];\n}\n\n/**\n * Every provider PACKAGE this application depends on, as a contribution target.\n *\n * Candidates come from the application root manifest AND from each runtime owner's manifest, because\n * both layouts are real: a scaffolded application declares its provider packages in the runtime owner\n * that imports them (`backend-api`), while a workspace root may hoist them. The union is deduplicated\n * by resolved package root, so a package declared in both places is walked once.\n *\n * A candidate that cannot be resolved on disk is SKIPPED rather than refused. The manifest is the\n * declaration and `node_modules` is the install; a name declared but not installed is an install\n * problem that `pnpm install` reports far better than a config-sync stack trace would, and refusing\n * here would make `wildo config sync` unrunnable in exactly the state where an operator runs it to\n * find out what is wrong.\n */\nfunction resolveProviderPackageTargets(\n saasRoot: string,\n runtimeOwnerTargets: ProviderContributionTarget[],\n): ProviderContributionTarget[] {\n const prefixes = resolveProviderPackagePrefixes(saasRoot);\n const searchRoots = [saasRoot, ...runtimeOwnerTargets.map((target) => target.packageRoot)];\n\n const candidateNames = new Set<string>();\n for (const searchRoot of searchRoots) {\n for (const dependencyName of readRuntimeReachablePackageNames(searchRoot)) {\n if (dependencyName === FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE\n || dependencyName === FRAMEWORK_ENGINE_PROVIDER_PACKAGE\n || prefixes.some((prefix) => dependencyName.startsWith(prefix))) {\n candidateNames.add(dependencyName);\n }\n }\n }\n\n const targetsByRoot = new Map<string, ProviderContributionTarget>();\n for (const packageName of [...candidateNames].sort()) {\n const packageRoot = resolveProviderPackageRoot(packageName, searchRoots);\n if (!packageRoot || targetsByRoot.has(packageRoot)) {\n continue;\n }\n targetsByRoot.set(packageRoot, {\n kind: ProviderContributionOwnerKind.PROVIDER_PACKAGE,\n key: packageName,\n ownerLabel: `provider package \"${packageName}\"`,\n packageRoot,\n });\n }\n\n return [...targetsByRoot.values()];\n}\n\n/**\n * The framework prefix, plus the application's own scope when its root manifest has one.\n *\n * Deriving the second from the root package name rather than reading it from configuration keeps the\n * \"one declaration\" promise of #330 intact: installing `@acme/provider-thing` in an `@acme` application\n * and scoping the ref is the whole of it — there is no third place to remember.\n */\nfunction resolveProviderPackagePrefixes(saasRoot: string): string[] {\n const prefixes = [FRAMEWORK_PROVIDER_PACKAGE_PREFIX];\n const rootPackageName = readPackageName(saasRoot);\n const scope = rootPackageName?.startsWith('@') ? rootPackageName.split('/')[0] : undefined;\n if (scope && scope !== '@wildo-ai') {\n prefixes.push(`${scope}/provider-`);\n }\n return prefixes;\n}\n\n/**\n * Locate an installed package's ROOT DIRECTORY, which is what the companion-entry resolver needs.\n *\n * The direct `node_modules` probe comes first because it is what pnpm actually produces — a symlink\n * per importer — and because it works for a package whose `exports` map declares no `./package.json`,\n * which `require.resolve` cannot see past. `createRequire` is the fallback for hoisted or otherwise\n * unusual layouts; it resolves the companion subpath (the one door every provider package declares)\n * and walks up to the manifest that names the package.\n */\nfunction resolveProviderPackageRoot(packageName: string, searchRoots: string[]): string | undefined {\n /*\n * The name comes from a manifest and is spliced into a filesystem path, so a segment that is `.` or\n * `..` would walk OUT of `node_modules` — and the prefix gate would not stop it, since\n * `@wildo-ai/provider-x/../../elsewhere` starts with the framework prefix. npm forbids such a name,\n * which is precisely why nothing downstream would question it; the check costs one line and is the\n * only thing standing between an authored dependency name and an arbitrary directory whose\n * companion entry this walk EXECUTES.\n */\n const segments = packageName.split('/');\n if (segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')) {\n return undefined;\n }\n\n for (const searchRoot of searchRoots) {\n const candidate = join(searchRoot, 'node_modules', ...segments);\n if (existsSync(join(candidate, 'package.json'))) {\n return candidate;\n }\n }\n\n for (const searchRoot of searchRoots) {\n try {\n const resolved = createRequire(join(searchRoot, 'package.json')).resolve(`${packageName}/companion`);\n let directory = dirname(resolved);\n while (directory !== dirname(directory)) {\n if (readPackageName(directory) === packageName) {\n return directory;\n }\n directory = dirname(directory);\n }\n } catch {\n // Not resolvable from this root; try the next one, then give up quietly (see the JSDoc above).\n }\n }\n\n return undefined;\n}\n\nfunction readPackageName(packageRoot: string): string | undefined {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n return undefined;\n }\n try {\n return (JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as { name?: string }).name;\n } catch {\n return undefined;\n }\n}\n\nasync function tryLoadRuntimeOwnerCompanionExports(\n packageRoot: string,\n): Promise<RuntimeOwnerCompanionExports | undefined> {\n try {\n resolvePackageCompanionEntryPath(packageRoot);\n } catch {\n return undefined;\n }\n\n return loadPackageCompanionExport<RuntimeOwnerCompanionExports>(packageRoot);\n}\n\nfunction validateRuntimeScopeAgainstDiscovery(input: {\n errors: string[];\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n scopeLabel: string;\n providers: NonNullable<WildoSaasConfig['providers']['scopes']['backend']>['providers'];\n matchesTarget: (target: ProviderCompanionRuntimeTarget) => boolean;\n}): void {\n const { errors, discoveredContributions, matchesTarget, providers, scopeLabel } = input;\n\n for (const [providerRef, authoredSelection] of Object.entries(providers)) {\n const matchingContributions = discoveredContributions.filter(\n (contribution) => contribution.ref === providerRef\n && contribution.runtimeTargets.some(matchesTarget),\n );\n\n if (matchingContributions.length === 0) {\n errors.push(\n `Provider \"${providerRef}\" is authored in scope \"${scopeLabel}\" but no companion export contributes it for that runtime.`,\n );\n continue;\n }\n\n const discoveredEngineCapabilities = new Set(\n matchingContributions.flatMap((contribution) => contribution.engineCapabilities),\n );\n const discoveredProviderCapabilities = new Set(\n matchingContributions.flatMap((contribution) => contribution.providerCapabilities),\n );\n const discoveredProtocols = new Set(\n matchingContributions.flatMap((contribution) => contribution.protocols),\n );\n\n for (const capability of authoredSelection.engineCapabilities) {\n if (!discoveredEngineCapabilities.has(capability)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares engine capability \"${capability}\" ` +\n 'but discovery does not report that capability for the same runtime.',\n );\n }\n }\n\n for (const capability of authoredSelection.providerCapabilities) {\n if (!discoveredProviderCapabilities.has(capability)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares provider capability \"${capability}\" ` +\n 'but discovery does not report that capability for the same runtime.',\n );\n }\n }\n\n for (const protocol of authoredSelection.protocols) {\n if (!discoveredProtocols.has(protocol)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares protocol \"${protocol}\" ` +\n 'but discovery does not report that protocol for the same runtime.',\n );\n }\n }\n }\n}\n\nfunction describeContribution(contribution: DiscoveredProviderCompanionContribution): string {\n return `Provider contribution \"${contribution.ref}\" from ${contribution.owner.kind} \"${contribution.owner.key}\"`;\n}\n\nfunction readRuntimeReachablePackageNames(packageRoot: string): Set<string> {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n return new Set<string>();\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n name?: string;\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n };\n\n return new Set([\n ...(packageJson.name ? [packageJson.name] : []),\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.peerDependencies ?? {}),\n ...Object.keys(packageJson.optionalDependencies ?? {}),\n ]);\n}\n\nfunction extractPackageName(importPath: string): string {\n if (importPath.startsWith('@')) {\n const [scope, pkg] = importPath.split('/');\n return `${scope}/${pkg}`;\n }\n return importPath.split('/')[0] ?? importPath;\n}\n\nfunction hasAnyProviders(\n providers: Record<string, unknown> | undefined,\n): boolean {\n return Boolean(providers && Object.keys(providers).length > 0);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider-companion-discovery.js","sourceRoot":"","sources":["../../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,mCAAmC,EAGA,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAExF;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,6BAeX;AAfD,WAAY,6BAA6B;IACvC,sGAAsG;IACtG,oDAAmB,CAAA;IACnB,mDAAmD;IACnD,oDAAmB,CAAA;IACnB,kDAAkD;IAClD,kDAAiB,CAAA;IACjB,uDAAuD;IACvD,kDAAiB,CAAA;IACjB;;;;OAIG;IACH,qEAAoC,CAAA;AACtC,CAAC,EAfW,6BAA6B,KAA7B,6BAA6B,QAexC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,C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CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;AAChD,CAAC;AAED,SAAS,eAAe,CACtB,SAA8C;IAE9C,OAAO,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { createRequire } from 'node:module';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport {\n ProviderCompanionContributionSchema,\n type ProviderCompanionContribution,\n type ProviderCompanionRuntimeTarget,\n type RuntimeOwnerCompanionExports, describeCaughtError } from '@wildo-ai/saas-models';\nimport type { WildoSaasConfig } from './define-saas-config';\nimport { loadPackageCompanionExport, resolvePackageCompanionEntryPath } from './loader';\n\n/**\n * `providerPackage` was added by #330 and is the point of that slice on this file.\n *\n * The other four owner kinds are RUNTIME OWNERS declared in `wildo.saas.config.ts` — an application's\n * own services, libraries, minions and workers. Walking only those is what made a provider shipped as\n * its own npm package invisible to discovery (audit finding PL-1): the package is a DEPENDENCY, not a\n * runtime owner, so nothing ever asked it what it contributes, and an application had to hand-author a\n * contribution for a provider whose own package already knew everything about it.\n */\nexport enum ProviderContributionOwnerKind {\n /** A service package declared in `wildo.saas.config.ts` — the application's backend or a frontend. */\n SERVICE = 'service',\n /** A shared library package of the application. */\n LIBRARY = 'library',\n /** A minion runtime, keyed by its minion name. */\n MINION = 'minion',\n /** A Node worker runtime, keyed by its worker name. */\n WORKER = 'worker',\n /**\n * A provider shipped as its own npm package (#330) — a DEPENDENCY rather than a runtime owner,\n * which is why it needed its own walk and its own member. The value stays camelCase because it is\n * substituted into operator-facing diagnostics beside the four above.\n */\n PROVIDER_PACKAGE = 'providerPackage',\n}\n\n/**\n * Package-name prefixes whose dependencies are treated as provider packages.\n *\n * `@wildo-ai/provider-` is the framework convention (#337 D3). An application's OWN provider packages\n * are admitted through the scope of its root manifest — an application published as `@acme/…` gets\n * `@acme/provider-…` for free — so a private provider needs no configuration to be discovered, and a\n * dependency belonging to somebody else's scope is never executed by this walk.\n */\nexport const FRAMEWORK_PROVIDER_PACKAGE_PREFIX = '@wildo-ai/provider-';\n\n/**\n * The framework's own scraped catalogue, admitted by exact NAME because it does not fit the prefix.\n *\n * Paul decided on 2026-09-06 that the transposed catalogue ships as ONE package with a subpath per\n * vendor — `@wildo-ai/providers/slack` — rather than as 697 packages. The prefix above predates that\n * decision and describes the shape it replaced, and `'@wildo-ai/providers'.startsWith('@wildo-ai/provider-')`\n * is **false**: the `s` is not a `-`.\n *\n * So discovery could not see the catalogue at all. What it DID admit, measured 2026-09-07, was\n * `@wildo-ai/provider-simulators` — the test doubles — and nothing else in the repository matches the\n * prefix. A rule that admits only the simulator of a thing is worse than no rule, because it looks\n * like coverage.\n *\n * An exact name rather than a loosened prefix (`@wildo-ai/provider`, no hyphen) on purpose: that\n * would also admit any future `@wildo-ai/providerfoo`, and the catalogue is ONE known package, not a\n * family. The prefix keeps serving the family it was written for — an application's own\n * `@acme/provider-thing`.\n */\nexport const FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE = '@wildo-ai/providers';\n\n/**\n * The ENGINE's own provider barrel, admitted exactly as the catalogue is.\n *\n * The engine ships 23 providers and exports them through `./companion` — the same shape every\n * provider package uses. Discovery did not admit it, so an application that wanted `resend` declared\n * it THREE times: the scope, a hand-authored `provider-contributions.ts` projecting the engine's own\n * metadata back at it, and the package dependency. The middle one carried no information the other\n * two lacked; config sync refused a scoped-but-uncontributed provider, so it was not optional either\n * (#358).\n *\n * A NAME rather than a prefix, for the reason the catalogue's own note gives: this is one known\n * package, not a family.\n */\nexport const FRAMEWORK_ENGINE_PROVIDER_PACKAGE = '@wildo-ai/external-connectors-private';\n\ninterface ProviderContributionOwner {\n kind: ProviderContributionOwnerKind;\n key: string;\n packageRoot: string;\n}\n\ninterface ProviderContributionTarget extends ProviderContributionOwner {\n ownerLabel: string;\n}\n\nexport interface DiscoveredProviderCompanionContribution extends ProviderCompanionContribution {\n owner: ProviderContributionOwner;\n}\n\n/**\n * An owner that DECLARES a `./companion` door and could not be read through it.\n *\n * Distinct from an owner that declares none, which is the ordinary case for most packages and is not\n * reported: the walk asks every candidate and expects most to answer nothing.\n */\nexport interface UnreadableProviderCompanionOwner {\n readonly ownerLabel: string;\n readonly packageRoot: string;\n readonly reason: string;\n}\n\nexport interface DiscoverSaasProviderCompanionContributionsResult {\n contributions: DiscoveredProviderCompanionContribution[];\n /**\n * Owners whose companion door exists and threw. EMPTY is the normal state.\n *\n * Reported because a walk that fails and a walk that finds nothing were previously the same\n * answer — both produced silence, and silence sums to a contribution COUNT (#1305). A count of\n * zero therefore read as a legitimate result rather than as a walk that failed, which is why\n * #1300 survived: a freshly scaffolded application reported 0 contributions and nothing\n * distinguished that from \"this application legitimately has no providers\".\n *\n * NOT a failure — `resolveProviderPackageTargets` argues correctly that a declared-but-uninstalled\n * package is an install problem `pnpm install` reports better than a config-sync stack trace. The\n * ask is visibility, so this is data a caller may render, not a refusal.\n */\n unreadableOwners: UnreadableProviderCompanionOwner[];\n}\n\n/**\n * The runtime targets an application's SCOPES imply for one provider ref.\n *\n * ## Why a package's declared targets cannot be the answer\n *\n * A provider PACKAGE is shipped once and installed by many applications, so it cannot know any of\n * their runtime topologies. Measured 2026-09-09: all 682 catalogue vendors declare\n * `[{ kind: 'backend' }]` and every engine contribution declares `backend` (plus `companion` for the\n * model-ish ones). Those are defaults standing in for an answer the package is not able to give —\n * a minion key or a worker key exists only in `wildo.saas.config.ts`.\n *\n * The consequence was latent rather than theoretical: a CATALOGUE provider scoped to a minion would\n * have failed materialization with \"no discovered contribution supplies its secret-contract shape\n * for this runtime\", because the package declares a `backend` target and the minion scope looks for\n * a `minion` one. No application had scoped one to a minion yet, so nothing had reported it.\n *\n * ## Why the scopes ARE the answer\n *\n * `providers.scopes` is where an application says which runtimes reach which provider — it is the\n * same decision, already authored, in the place the runtime artifact is built from. Measured against\n * Wonder Todos' hand-authored projections: the scopes reproduce 9 of 10 target sets EXACTLY, and the\n * tenth is a SURPLUS (a `companion` target for a provider the companion scope does not name) which\n * the artifact discards anyway, since it is built from scope INTERSECT contribution.\n *\n * So nothing is lost by deriving, and what is gained is that an application declares a provider once.\n *\n * Applies to contributions discovered from a PACKAGE. A runtime owner's own companion barrel keeps\n * whatever it declares: that is the application's own file talking about itself, and an application\n * package is entitled to state a target the scopes do not.\n */\nfunction resolveScopeImpliedRuntimeTargets(\n providerRef: string,\n saasConfig: Pick<WildoSaasConfig, 'providers'>,\n): ProviderCompanionContribution['runtimeTargets'] {\n const scopes = saasConfig.providers?.scopes;\n if (!scopes) return [];\n const targets: ProviderCompanionContribution['runtimeTargets'] = [];\n\n if (scopes.backend?.providers?.[providerRef]) targets.push({ kind: 'backend' });\n if (scopes.companion?.providers?.[providerRef]) targets.push({ kind: 'companion' });\n for (const [minionKey, scope] of Object.entries(scopes.minions ?? {})) {\n if (scope?.providers?.[providerRef]) targets.push({ kind: 'minion', minionKey });\n }\n for (const [workerKey, scope] of Object.entries(scopes.workers ?? {})) {\n if (scope?.providers?.[providerRef]) targets.push({ kind: 'worker', workerKey });\n }\n return targets;\n}\n\nexport async function discoverSaasProviderCompanionContributions(input: {\n saasRoot: string;\n saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>;\n}): Promise<DiscoverSaasProviderCompanionContributionsResult> {\n const contributions: DiscoveredProviderCompanionContribution[] = [];\n\n const runtimeOwnerTargets = resolveContributionTargets(input.saasRoot, input.saasConfig);\n\n const unreadableOwners: UnreadableProviderCompanionOwner[] = [];\n\n for (const target of [\n ...runtimeOwnerTargets,\n // Unfiltered roots, NOT `runtimeOwnerTargets` — see `resolveRuntimeOwnerPackageRoots` (#1300).\n ...resolveProviderPackageTargets(\n input.saasRoot,\n resolveRuntimeOwnerPackageRoots(input.saasRoot, input.saasConfig),\n ),\n ]) {\n const loaded = await tryLoadRuntimeOwnerCompanionExports(target.packageRoot);\n if (loaded.unreadable !== undefined) {\n unreadableOwners.push({\n ownerLabel: target.ownerLabel,\n packageRoot: target.packageRoot,\n reason: loaded.unreadable,\n });\n continue;\n }\n if (!loaded.exports) {\n continue;\n }\n\n const parsedContributions = ProviderCompanionContributionSchema.array().parse(\n loaded.exports.providerContributions ?? [],\n );\n\n // A PACKAGE cannot know this application's runtime topology, so its declared targets are a\n // default and the SCOPES are the answer. A runtime owner's own barrel keeps what it declares —\n // see `resolveScopeImpliedRuntimeTargets`.\n const derivesTargetsFromScopes = target.kind === ProviderContributionOwnerKind.PROVIDER_PACKAGE;\n\n contributions.push(\n ...parsedContributions.map((contribution) => ({\n ...contribution,\n runtimeTargets: derivesTargetsFromScopes\n ? resolveScopeImpliedRuntimeTargets(contribution.ref, input.saasConfig)\n : contribution.runtimeTargets,\n owner: {\n kind: target.kind,\n key: target.key,\n packageRoot: target.packageRoot,\n },\n })),\n );\n }\n\n return { contributions, unreadableOwners };\n}\n\n/**\n * Walk an application's provider contributions and VALIDATE them — one step, because the two must\n * never come apart (#334).\n *\n * The walk was already shared; what was duplicated is the PAIRING. `wildo config sync` and\n * `wildo lock check` each called the walker and then, separately, the validator — and the validator\n * sits outside the walker, so a consumer that forgot it would compute a lockfile section from\n * contributions nobody had checked against the authored scope. Three correct call sites with nothing\n * making a fourth correct is the shape `.claude/rules/invariant-call-site-enumeration.md` is about.\n *\n * The caller still LOADS the config. That is deliberate rather than an omission: loading is one line\n * each caller already owns with its own error handling, it is not the part that can silently come\n * apart, and folding it in here would put the load behind a seam that the sync service's own tests\n * mock — `loadSaasConfig` mocked as a module export is not seen by a caller INSIDE this module, so\n * those tests would have had to mock this function instead and would then no longer exercise the real\n * discovery and the real validation they exist to check.\n */\nexport async function resolveValidatedSaasProviderContributions(input: {\n saasRoot: string;\n saasConfig: Pick<WildoSaasConfig, 'modules' | 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>;\n}): Promise<DiscoveredProviderCompanionContribution[]> {\n const { contributions, unreadableOwners } = await discoverSaasProviderCompanionContributions(input);\n validateDiscoveredSaasProviderContributions({\n saasConfig: input.saasConfig,\n discoveredContributions: contributions,\n unreadableOwners,\n });\n return contributions;\n}\n\nexport function validateDiscoveredSaasProviderContributions(input: {\n saasConfig: Pick<WildoSaasConfig, 'modules' | 'providers' | 'services' | 'minions' | 'workers'>;\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n /**\n * The owners the walk could not read. They never decide the verdict — unreadable is DATA, not a\n * refusal (see `DiscoverSaasProviderCompanionContributionsResult.unreadableOwners`) — but when the\n * validation refuses anyway, they are usually WHY: their contributions are simply missing from what\n * was validated. So a refusal names them, with the reason each could not be read.\n */\n unreadableOwners?: readonly UnreadableProviderCompanionOwner[];\n}): void {\n const { saasConfig, discoveredContributions } = input;\n const errors: string[] = [];\n const declaredModuleIds = new Set(Object.keys(saasConfig.modules ?? {}));\n const declaredServiceKeys = new Set(Object.keys(saasConfig.services ?? {}));\n const serviceKeyToFrontendType = new Map<string, string>(\n Object.entries(saasConfig.services ?? {})\n .filter(([, definition]) => definition.frontendType !== undefined)\n .map(([serviceKey, definition]) => [serviceKey, definition.frontendType as string]),\n );\n const declaredFrontendServiceKeys = new Set(serviceKeyToFrontendType.keys());\n const declaredFrontendTypes = new Set(serviceKeyToFrontendType.values());\n const declaredMinionKeys = new Set(Object.keys(saasConfig.minions ?? {}));\n const declaredWorkerKeys = new Set(Object.keys(saasConfig.workers ?? {}));\n\n for (const contribution of discoveredContributions) {\n if (contribution.sourceModuleId && !declaredModuleIds.has(contribution.sourceModuleId)) {\n errors.push(\n `${describeContribution(contribution)} references sourceModuleId \"${contribution.sourceModuleId}\" ` +\n 'but that module is not declared in wildo.saas.config.ts.',\n );\n }\n\n const dependencyNames = readRuntimeReachablePackageNames(contribution.owner.packageRoot);\n const runtimePackageName = extractPackageName(contribution.runtimeImportPath);\n if (!dependencyNames.has(runtimePackageName)) {\n errors.push(\n `${describeContribution(contribution)} declares runtimeImportPath \"${contribution.runtimeImportPath}\" ` +\n `but ${contribution.owner.kind} \"${contribution.owner.key}\" does not depend on \"${runtimePackageName}\".`,\n );\n }\n\n for (const target of contribution.runtimeTargets) {\n switch (target.kind) {\n case 'frontendService':\n if (!declaredFrontendTypes.has(target.serviceType)) {\n errors.push(\n `${describeContribution(contribution)} targets frontendType \"${target.serviceType}\" ` +\n 'but no service with that frontendType is declared in wildo.saas.config.ts.',\n );\n } else if (!contribution.frontendEntry) {\n errors.push(\n `${describeContribution(contribution)} targets frontendType \"${target.serviceType}\" ` +\n 'but does not provide a frontendEntry payload for bootstrap materialization.',\n );\n }\n break;\n case 'minion':\n if (!declaredMinionKeys.has(target.minionKey)) {\n errors.push(\n `${describeContribution(contribution)} targets unknown minion \"${target.minionKey}\".`,\n );\n }\n break;\n case 'worker':\n if (!declaredWorkerKeys.has(target.workerKey)) {\n errors.push(\n `${describeContribution(contribution)} targets unknown worker \"${target.workerKey}\".`,\n );\n }\n break;\n case 'backend':\n case 'companion':\n break;\n }\n }\n }\n\n const runtimeScopes = saasConfig.providers.scopes;\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: 'backend',\n providers: runtimeScopes.backend?.providers ?? {},\n matchesTarget: (target) => target.kind === 'backend',\n });\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: 'companion',\n providers: runtimeScopes.companion?.providers ?? {},\n matchesTarget: (target) => target.kind === 'companion',\n });\n\n for (const [serviceKey, scope] of Object.entries(runtimeScopes.frontendServices ?? {})) {\n if (!declaredServiceKeys.has(serviceKey)) {\n errors.push(`Provider scope references unknown frontend service \"${serviceKey}\".`);\n continue;\n }\n if (!declaredFrontendServiceKeys.has(serviceKey)) {\n errors.push(\n `Provider scope references non-frontend service \"${serviceKey}\". ` +\n 'Only services with a frontendType may appear under providers.scopes.frontendServices.',\n );\n continue;\n }\n const serviceType = serviceKeyToFrontendType.get(serviceKey);\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `frontendServices.${serviceKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'frontendService' && target.serviceType === serviceType,\n });\n }\n\n for (const [minionKey, scope] of Object.entries(runtimeScopes.minions ?? {})) {\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `minions.${minionKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'minion' && target.minionKey === minionKey,\n });\n }\n\n for (const [workerKey, scope] of Object.entries(runtimeScopes.workers ?? {})) {\n validateRuntimeScopeAgainstDiscovery({\n errors,\n discoveredContributions,\n scopeLabel: `workers.${workerKey}`,\n providers: scope.providers,\n matchesTarget: (target) => target.kind === 'worker' && target.workerKey === workerKey,\n });\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Provider companion-export discovery validation failed:\\n- ${errors.join('\\n- ')}`\n + describeUnreadableOwnersForRefusal(input.unreadableOwners ?? []),\n );\n }\n}\n\n/**\n * The part of a refusal that says the walk was INCOMPLETE, or nothing when it was not.\n *\n * Measured 2026-09-24 (#1558): Wonder CRM's frontend companion could not be loaded — its injected\n * engine snapshot was missing a file — so it contributed nothing, and the refusal said only\n * `Provider \"sentry\" is authored in scope \"frontendServices.app\" but no companion export contributes\n * it`. That names the CATALOGUE; the cause was a LOAD. The first diagnosis recorded it as a provider\n * decision. Naming the unreadable owner and its reason beside the refusal points at the real remedy.\n */\nfunction describeUnreadableOwnersForRefusal(unreadableOwners: readonly UnreadableProviderCompanionOwner[]): string {\n if (unreadableOwners.length === 0) return '';\n return '\\nThese runtime owners could not be READ, so anything they contribute is missing above — '\n + 'repair the load before concluding a provider is uncontributed:\\n- '\n + unreadableOwners.map((owner) => `${owner.ownerLabel} (${owner.packageRoot}): ${owner.reason}`).join('\\n- ');\n}\n\n/**\n * Every runtime owner's package root, UNFILTERED — the roots a provider PACKAGE may be declared in.\n *\n * Distinct from {@link resolveContributionTargets} on purpose, and the distinction is the whole of\n * issue #1300. That function answers \"whose own companion exports should we LOAD\", and it correctly\n * skips an owner with nothing scoped to it: such an owner contributes nothing relevant. This one\n * answers \"whose MANIFEST may name a provider package\", and for that question the scopes are not\n * evidence — a manifest declares `@wildo-ai/external-connectors-private` whether or not the\n * application has yet scoped anything from it.\n *\n * Reusing the filtered set for both made provider discovery CIRCULAR: a backend service entered the\n * search only when `providers.scopes.backend` already had providers, so a freshly scaffolded\n * application — whose scopes are all empty — searched only its root manifest, found no provider\n * package, discovered ZERO contributions, and refused every provider it tried to scope with\n * \"no companion export contributes it for that runtime\". Scoping a provider required having already\n * scoped one. Measured on a fresh application: 0 contributions with empty scopes, 23 the moment one\n * provider was added to the backend scope, from the same manifests and the same installed packages.\n *\n * The cost of not filtering is reading a few more `package.json` files; `resolveProviderPackageTargets`\n * de-duplicates by resolved package root and skips what it cannot resolve.\n */\nfunction resolveRuntimeOwnerPackageRoots(\n saasRoot: string,\n saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'workers'>,\n): string[] {\n return [\n ...Object.values(saasConfig.services),\n ...Object.values(saasConfig.libraries ?? {}),\n ...Object.values(saasConfig.minions ?? {}),\n ...Object.values(saasConfig.workers ?? {}),\n ].map((definition) => resolve(saasRoot, definition.path));\n}\n\nfunction resolveContributionTargets(\n saasRoot: string,\n saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>,\n): ProviderContributionTarget[] {\n const shouldIncludeBackendServices = hasAnyProviders(saasConfig.providers.scopes.backend?.providers);\n const frontendServiceProviderScopes = Object.entries(saasConfig.providers.scopes.frontendServices ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([serviceKey]) => serviceKey);\n const minionProviderScopes = Object.entries(saasConfig.providers.scopes.minions ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([minionKey]) => minionKey);\n const workerProviderScopes = Object.entries(saasConfig.providers.scopes.workers ?? {})\n .filter(([, scope]) => hasAnyProviders(scope.providers))\n .map(([workerKey]) => workerKey);\n\n return [\n ...Object.entries(saasConfig.services)\n .filter(([key, definition]) => (\n definition.frontendType\n ? frontendServiceProviderScopes.includes(key)\n : shouldIncludeBackendServices\n ))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.SERVICE,\n key,\n ownerLabel: `service \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.libraries ?? {}).map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.LIBRARY,\n key,\n ownerLabel: `library \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.minions ?? {})\n .filter(([key]) => minionProviderScopes.includes(key))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.MINION,\n key,\n ownerLabel: `minion \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ...Object.entries(saasConfig.workers ?? {})\n .filter(([key]) => workerProviderScopes.includes(key))\n .map(([key, definition]) => ({\n kind: ProviderContributionOwnerKind.WORKER,\n key,\n ownerLabel: `worker \"${key}\"`,\n packageRoot: resolve(saasRoot, definition.path),\n })),\n ];\n}\n\n/**\n * Every provider PACKAGE this application depends on, as a contribution target.\n *\n * Candidates come from the application root manifest AND from each runtime owner's manifest, because\n * both layouts are real: a scaffolded application declares its provider packages in the runtime owner\n * that imports them (`backend-api`), while a workspace root may hoist them. The union is deduplicated\n * by resolved package root, so a package declared in both places is walked once.\n *\n * A candidate that cannot be resolved on disk is SKIPPED rather than refused. The manifest is the\n * declaration and `node_modules` is the install; a name declared but not installed is an install\n * problem that `pnpm install` reports far better than a config-sync stack trace would, and refusing\n * here would make `wildo config sync` unrunnable in exactly the state where an operator runs it to\n * find out what is wrong.\n */\nfunction resolveProviderPackageTargets(\n saasRoot: string,\n runtimeOwnerPackageRoots: string[],\n): ProviderContributionTarget[] {\n const prefixes = resolveProviderPackagePrefixes(saasRoot);\n const searchRoots = [saasRoot, ...runtimeOwnerPackageRoots];\n\n const candidateNames = new Set<string>();\n for (const searchRoot of searchRoots) {\n for (const dependencyName of readRuntimeReachablePackageNames(searchRoot)) {\n if (dependencyName === FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE\n || dependencyName === FRAMEWORK_ENGINE_PROVIDER_PACKAGE\n || prefixes.some((prefix) => dependencyName.startsWith(prefix))) {\n candidateNames.add(dependencyName);\n }\n }\n }\n\n const targetsByRoot = new Map<string, ProviderContributionTarget>();\n for (const packageName of [...candidateNames].sort()) {\n const packageRoot = resolveProviderPackageRoot(packageName, searchRoots);\n if (!packageRoot || targetsByRoot.has(packageRoot)) {\n continue;\n }\n targetsByRoot.set(packageRoot, {\n kind: ProviderContributionOwnerKind.PROVIDER_PACKAGE,\n key: packageName,\n ownerLabel: `provider package \"${packageName}\"`,\n packageRoot,\n });\n }\n\n return [...targetsByRoot.values()];\n}\n\n/**\n * The framework prefix, plus the application's own scope when its root manifest has one.\n *\n * Deriving the second from the root package name rather than reading it from configuration keeps the\n * \"one declaration\" promise of #330 intact: installing `@acme/provider-thing` in an `@acme` application\n * and scoping the ref is the whole of it — there is no third place to remember.\n */\nfunction resolveProviderPackagePrefixes(saasRoot: string): string[] {\n const prefixes = [FRAMEWORK_PROVIDER_PACKAGE_PREFIX];\n const rootPackageName = readPackageName(saasRoot);\n const scope = rootPackageName?.startsWith('@') ? rootPackageName.split('/')[0] : undefined;\n if (scope && scope !== '@wildo-ai') {\n prefixes.push(`${scope}/provider-`);\n }\n return prefixes;\n}\n\n/**\n * Locate an installed package's ROOT DIRECTORY, which is what the companion-entry resolver needs.\n *\n * The direct `node_modules` probe comes first because it is what pnpm actually produces — a symlink\n * per importer — and because it works for a package whose `exports` map declares no `./package.json`,\n * which `require.resolve` cannot see past. `createRequire` is the fallback for hoisted or otherwise\n * unusual layouts; it resolves the companion subpath (the one door every provider package declares)\n * and walks up to the manifest that names the package.\n */\nfunction resolveProviderPackageRoot(packageName: string, searchRoots: string[]): string | undefined {\n /*\n * The name comes from a manifest and is spliced into a filesystem path, so a segment that is `.` or\n * `..` would walk OUT of `node_modules` — and the prefix gate would not stop it, since\n * `@wildo-ai/provider-x/../../elsewhere` starts with the framework prefix. npm forbids such a name,\n * which is precisely why nothing downstream would question it; the check costs one line and is the\n * only thing standing between an authored dependency name and an arbitrary directory whose\n * companion entry this walk EXECUTES.\n */\n const segments = packageName.split('/');\n if (segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')) {\n return undefined;\n }\n\n for (const searchRoot of searchRoots) {\n const candidate = join(searchRoot, 'node_modules', ...segments);\n if (existsSync(join(candidate, 'package.json'))) {\n return candidate;\n }\n }\n\n for (const searchRoot of searchRoots) {\n try {\n const resolved = createRequire(join(searchRoot, 'package.json')).resolve(`${packageName}/companion`);\n let directory = dirname(resolved);\n while (directory !== dirname(directory)) {\n if (readPackageName(directory) === packageName) {\n return directory;\n }\n directory = dirname(directory);\n }\n } catch {\n // Not resolvable from this root; try the next one, then give up quietly (see the JSDoc above).\n }\n }\n\n return undefined;\n}\n\nfunction readPackageName(packageRoot: string): string | undefined {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n return undefined;\n }\n try {\n return (JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as { name?: string }).name;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Read one owner's companion barrel, separating the two answers that used to look identical.\n *\n * - `{ exports: undefined }` — the package declares no `./companion` door. Ordinary: most packages\n * do not, and the walk asks everything it can reach.\n * - `{ unreadable }` — the door EXISTS and reading it threw. A broken or unbuilt install, not an\n * absence, and the one case worth telling somebody about.\n */\nasync function tryLoadRuntimeOwnerCompanionExports(\n packageRoot: string,\n): Promise<{ exports?: RuntimeOwnerCompanionExports; unreadable?: string }> {\n try {\n resolvePackageCompanionEntryPath(packageRoot);\n } catch {\n return {};\n }\n\n try {\n return { exports: await loadPackageCompanionExport<RuntimeOwnerCompanionExports>(packageRoot) };\n } catch (error) {\n return { unreadable: describeCaughtError(error) };\n }\n}\n\nfunction validateRuntimeScopeAgainstDiscovery(input: {\n errors: string[];\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n scopeLabel: string;\n providers: NonNullable<WildoSaasConfig['providers']['scopes']['backend']>['providers'];\n matchesTarget: (target: ProviderCompanionRuntimeTarget) => boolean;\n}): void {\n const { errors, discoveredContributions, matchesTarget, providers, scopeLabel } = input;\n\n for (const [providerRef, authoredSelection] of Object.entries(providers)) {\n const matchingContributions = discoveredContributions.filter(\n (contribution) => contribution.ref === providerRef\n && contribution.runtimeTargets.some(matchesTarget),\n );\n\n if (matchingContributions.length === 0) {\n errors.push(\n `Provider \"${providerRef}\" is authored in scope \"${scopeLabel}\" but no companion export contributes it for that runtime.`,\n );\n continue;\n }\n\n const discoveredEngineCapabilities = new Set(\n matchingContributions.flatMap((contribution) => contribution.engineCapabilities),\n );\n const discoveredProviderCapabilities = new Set(\n matchingContributions.flatMap((contribution) => contribution.providerCapabilities),\n );\n const discoveredProtocols = new Set(\n matchingContributions.flatMap((contribution) => contribution.protocols),\n );\n\n for (const capability of authoredSelection.engineCapabilities) {\n if (!discoveredEngineCapabilities.has(capability)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares engine capability \"${capability}\" ` +\n 'but discovery does not report that capability for the same runtime.',\n );\n }\n }\n\n for (const capability of authoredSelection.providerCapabilities) {\n if (!discoveredProviderCapabilities.has(capability)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares provider capability \"${capability}\" ` +\n 'but discovery does not report that capability for the same runtime.',\n );\n }\n }\n\n for (const protocol of authoredSelection.protocols) {\n if (!discoveredProtocols.has(protocol)) {\n errors.push(\n `Provider \"${providerRef}\" in scope \"${scopeLabel}\" declares protocol \"${protocol}\" ` +\n 'but discovery does not report that protocol for the same runtime.',\n );\n }\n }\n }\n}\n\nfunction describeContribution(contribution: DiscoveredProviderCompanionContribution): string {\n return `Provider contribution \"${contribution.ref}\" from ${contribution.owner.kind} \"${contribution.owner.key}\"`;\n}\n\nfunction readRuntimeReachablePackageNames(packageRoot: string): Set<string> {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n return new Set<string>();\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n name?: string;\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n };\n\n return new Set([\n ...(packageJson.name ? [packageJson.name] : []),\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.peerDependencies ?? {}),\n ...Object.keys(packageJson.optionalDependencies ?? {}),\n ]);\n}\n\nfunction extractPackageName(importPath: string): string {\n if (importPath.startsWith('@')) {\n const [scope, pkg] = importPath.split('/');\n return `${scope}/${pkg}`;\n }\n return importPath.split('/')[0] ?? importPath;\n}\n\nfunction hasAnyProviders(\n providers: Record<string, unknown> | undefined,\n): boolean {\n return Boolean(providers && Object.keys(providers).length > 0);\n}\n"]}
|
|
@@ -78,27 +78,6 @@ declare const RuntimeProviderModulesArtifactSchema: z.ZodObject<{
|
|
|
78
78
|
moduleIdsByService: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
79
79
|
}, z.core.$strict>;
|
|
80
80
|
export type RuntimeProviderModulesArtifact = z.infer<typeof RuntimeProviderModulesArtifactSchema>;
|
|
81
|
-
/**
|
|
82
|
-
* The per-service frontend bootstrap map, ANNOTATED through a nominal interface rather than inferred.
|
|
83
|
-
*
|
|
84
|
-
* `FrontendProvidersBlockSchema` transitively references three atoms that `@wildo-ai/saas-models`
|
|
85
|
-
* publishes from `/public-runtime` alone, so a consumer that resolves this package's dependency to
|
|
86
|
-
* SOURCE — the minion and worker libraries do, deliberately — has no public specifier through which
|
|
87
|
-
* to NAME them. While the artifact object stayed small TypeScript inlined the shape and nobody
|
|
88
|
-
* noticed; the moment it grew one member past the inline threshold it needed the name and refused:
|
|
89
|
-
* `TS2742 … cannot be named without a reference to
|
|
90
|
-
* node_modules/@wildo-ai/saas-models/src/external-providers/provider-frontend-surface.shared.schemas`.
|
|
91
|
-
*
|
|
92
|
-
* An INTERFACE is what stops the expansion — a type alias is written out structurally in the emitted
|
|
93
|
-
* declaration and takes the unnameable atoms with it, while an interface is written by name. The
|
|
94
|
-
* underlying defect is a root-exported contract depending on a subpath-only module
|
|
95
|
-
* (`package-public-entrypoints.md`, "The root barrel must not DEPEND on a subpath-only surface");
|
|
96
|
-
* that module is the frozen provider contract, so it is filed as #356 rather than fixed here. Runtime
|
|
97
|
-
* behaviour and the inferred field type are unchanged.
|
|
98
|
-
*/
|
|
99
|
-
export interface RuntimeProviderFrontendBootstraps {
|
|
100
|
-
[serviceKey: string]: FrontendProvidersBlock;
|
|
101
|
-
}
|
|
102
81
|
export declare const SaasRuntimeProvidersArtifactSchema: z.ZodObject<{
|
|
103
82
|
__AUTOGENERATED__: z.ZodLiteral<"AUTO-GENERATED FILE. DO NOT EDIT. Regenerate with `wildo config sync`.">;
|
|
104
83
|
generatedBy: z.ZodLiteral<"wildo provider-runtime-artifact">;
|
|
@@ -118,6 +97,19 @@ export declare const SaasRuntimeProvidersArtifactSchema: z.ZodObject<{
|
|
|
118
97
|
* without consulting this record, so an un-resynced application is unaffected.
|
|
119
98
|
*/
|
|
120
99
|
providerRuntimeImports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
100
|
+
/**
|
|
101
|
+
* Package specifiers that ship SYSTEM-OF-RECORD VENDOR FACETS, in discovery order (#1057).
|
|
102
|
+
*
|
|
103
|
+
* A list rather than a `vendor -> specifier` map, because a facet module contributes a RECORD of
|
|
104
|
+
* vendors rather than one module per vendor: a map would restate the record's own keys in a
|
|
105
|
+
* generated artifact read by a different process, free to disagree with it. The backend imports
|
|
106
|
+
* each specifier in order and takes the first that answers for the vendor.
|
|
107
|
+
*
|
|
108
|
+
* Discovered from the MANIFEST — a package declaring an `./systems-of-record` export — never from
|
|
109
|
+
* loading it. Sync has no business evaluating a vendor facet, and the manifest is the same door
|
|
110
|
+
* `./companion` is found through.
|
|
111
|
+
*/
|
|
112
|
+
systemOfRecordFacetModules: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
113
|
providerGraphDigest: z.ZodString;
|
|
122
114
|
lockfileSectionDigest: z.ZodString;
|
|
123
115
|
artifactKind: z.ZodEnum<{
|
|
@@ -161,7 +153,64 @@ export declare const SaasRuntimeProvidersArtifactSchema: z.ZodObject<{
|
|
|
161
153
|
whenUnavailable: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
162
154
|
}, z.core.$strict>>>;
|
|
163
155
|
}, z.core.$strict>>>;
|
|
164
|
-
frontendProviderBootstraps: z.ZodOptional<z.
|
|
156
|
+
frontendProviderBootstraps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
157
|
+
providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
158
|
+
metadata: z.ZodObject<{
|
|
159
|
+
ref: z.ZodString;
|
|
160
|
+
packageName: z.ZodString;
|
|
161
|
+
tier: z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderTier>;
|
|
162
|
+
vendor: z.ZodString;
|
|
163
|
+
origin: z.ZodObject<{
|
|
164
|
+
kind: z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderOriginKind>;
|
|
165
|
+
catalogue: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
source: z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderCatalogueSource>;
|
|
167
|
+
sourceRef: z.ZodString;
|
|
168
|
+
sourceVersion: z.ZodString;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
displayNameLabelKey: z.ZodOptional<z.ZodString>;
|
|
172
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
173
|
+
iconRef: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
providerCapabilities: z.ZodArray<z.ZodString>;
|
|
176
|
+
protocols: z.ZodArray<z.ZodString>;
|
|
177
|
+
publicConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
178
|
+
csp: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
scriptOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
180
|
+
connectOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
181
|
+
frameOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
182
|
+
imgOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
183
|
+
styleOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
184
|
+
fontOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
185
|
+
derivedOrigins: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
186
|
+
publicConfigKey: z.ZodString;
|
|
187
|
+
bucket: z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderFrontendCspOriginBucket>;
|
|
188
|
+
}, z.core.$strict>>>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
sdk: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
packageName: z.ZodString;
|
|
192
|
+
versionRange: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strict>>;
|
|
194
|
+
scripts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
src: z.ZodString;
|
|
196
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
197
|
+
crossOrigin: z.ZodOptional<z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderFrontendScriptCrossOrigin>>;
|
|
198
|
+
async: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
+
}, z.core.$strict>>>;
|
|
201
|
+
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
202
|
+
selectionDelivery: z.ZodOptional<z.ZodEnum<typeof import("@wildo-ai/saas-models").ProviderFrontendSelectionDelivery>>;
|
|
203
|
+
}, z.core.$strict>>>;
|
|
204
|
+
publicConfigKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
205
|
+
fileStorage: z.ZodOptional<z.ZodEnum<{
|
|
206
|
+
readonly WILDO_MANAGED: "wildo_managed";
|
|
207
|
+
readonly LOCAL_DIRECTORY: "local_directory";
|
|
208
|
+
readonly ONEDRIVE: "onedrive";
|
|
209
|
+
readonly GOOGLE_DRIVE: "google_drive";
|
|
210
|
+
readonly DROPBOX: "dropbox";
|
|
211
|
+
}>>;
|
|
212
|
+
}, z.core.$loose>>>;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
165
214
|
}, z.core.$strict>;
|
|
166
215
|
export type SaasRuntimeProvidersArtifact = z.infer<typeof SaasRuntimeProvidersArtifactSchema>;
|
|
167
216
|
export interface MaterializedSaasProviderRuntimeArtifacts {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-runtime-artifacts.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"provider-runtime-artifacts.d.ts","sourceRoot":"","sources":["../../../../src/project-config/provider-runtime-artifacts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAOL,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,4BAA4B,EAElC,MAAM,4CAA4C,CAAC;AAMpD,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,gCAAgC,CAAC;AAE9F,eAAO,MAAM,+CAA+C,2EACc,CAAC;AAE3E,eAAO,MAAM,mCAAmC,oCAAoC,C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AE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,oBAAoB,EAAE,MAAM,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,sCAAsC,CAqCzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,IAAI,CA8BP;AAED,KAAK,2BAA2B,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;QACxB,kBAAkB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAC5C,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KAClC,CAAC,CAAC;CACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { resolve as resolvePath } from 'node:path';
|
|
3
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY, FrontendProviderPublicConfigError, FrontendProvidersBlockSchema, overlayFrontendProviderPublicConfig, } from '@wildo-ai/saas-models';
|
|
6
6
|
import { SaasLockfileProvidersSectionSchema, } from '../lockfile/wildo-saas-lock.shared.schemas.js';
|
|
@@ -86,6 +86,30 @@ const RuntimeProviderModulesArtifactSchema = z.strictObject({
|
|
|
86
86
|
moduleIds: z.array(z.string().min(1)).default([]),
|
|
87
87
|
moduleIdsByService: z.record(z.string(), z.array(z.string().min(1))).default({}),
|
|
88
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* The per-service frontend bootstrap map, keyed by frontend service key.
|
|
91
|
+
*
|
|
92
|
+
* ## It was an ANNOTATED interface until 2026-09-12, and the workaround is gone (#356)
|
|
93
|
+
*
|
|
94
|
+
* `FrontendProvidersBlockSchema` transitively references three atoms — `ProviderFrontendCspOriginBucket`,
|
|
95
|
+
* `ProviderFrontendScriptCrossOrigin`, `ProviderFrontendSelectionDelivery` — that `@wildo-ai/saas-models`
|
|
96
|
+
* published from `/public-runtime` ALONE. While this artifact object stayed small TypeScript inlined the
|
|
97
|
+
* shape and nobody noticed; adding one member past the inline threshold made it reach for the NAME and
|
|
98
|
+
* refuse, here and in `saas-backend-lib` at the same time:
|
|
99
|
+
*
|
|
100
|
+
* `TS2742 … cannot be named without a reference to
|
|
101
|
+
* node_modules/@wildo-ai/saas-models/src/external-providers/provider-frontend-surface.shared.schemas`.
|
|
102
|
+
*
|
|
103
|
+
* #330 stopped the expansion with a locally declared interface, deliberately as a workaround: an
|
|
104
|
+
* interface is written BY NAME in the emitted declaration where a type alias expands structurally and
|
|
105
|
+
* takes the unnameable atoms with it. The boundary has since MOVED — the root barrel now exports that
|
|
106
|
+
* module — so the atoms are nameable through the package root and the workaround has nothing left to do.
|
|
107
|
+
*
|
|
108
|
+
* Verified with the probe `package-public-entrypoints.md` prescribes rather than by re-running the
|
|
109
|
+
* source-mapped packages: a consumer importing ONLY `@wildo-ai/saas-models`, deriving a record over
|
|
110
|
+
* `FrontendProvidersBlockSchema`, compiled with `declaration: true`. It names all three atoms through
|
|
111
|
+
* `import("@wildo-ai/saas-models")` and reaches no relative `node_modules` path at all.
|
|
112
|
+
*/
|
|
89
113
|
const FrontendProviderBootstrapsSchema = z.record(z.string().min(1), FrontendProvidersBlockSchema);
|
|
90
114
|
export const SaasRuntimeProvidersArtifactSchema = z.strictObject({
|
|
91
115
|
__AUTOGENERATED__: z.literal(PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING),
|
|
@@ -106,6 +130,19 @@ export const SaasRuntimeProvidersArtifactSchema = z.strictObject({
|
|
|
106
130
|
* without consulting this record, so an un-resynced application is unaffected.
|
|
107
131
|
*/
|
|
108
132
|
providerRuntimeImports: z.record(z.string().min(1), z.string().min(1)).optional(),
|
|
133
|
+
/**
|
|
134
|
+
* Package specifiers that ship SYSTEM-OF-RECORD VENDOR FACETS, in discovery order (#1057).
|
|
135
|
+
*
|
|
136
|
+
* A list rather than a `vendor -> specifier` map, because a facet module contributes a RECORD of
|
|
137
|
+
* vendors rather than one module per vendor: a map would restate the record's own keys in a
|
|
138
|
+
* generated artifact read by a different process, free to disagree with it. The backend imports
|
|
139
|
+
* each specifier in order and takes the first that answers for the vendor.
|
|
140
|
+
*
|
|
141
|
+
* Discovered from the MANIFEST — a package declaring an `./systems-of-record` export — never from
|
|
142
|
+
* loading it. Sync has no business evaluating a vendor facet, and the manifest is the same door
|
|
143
|
+
* `./companion` is found through.
|
|
144
|
+
*/
|
|
145
|
+
systemOfRecordFacetModules: z.array(z.string().min(1)).optional(),
|
|
109
146
|
providerGraphDigest: z.string().min(1),
|
|
110
147
|
lockfileSectionDigest: z.string().min(1),
|
|
111
148
|
artifactKind: z.enum([
|
|
@@ -131,6 +168,18 @@ config, options) {
|
|
|
131
168
|
const frontendServiceTypes = Object.fromEntries(Object.entries(config.services ?? {})
|
|
132
169
|
.filter(([, definition]) => definition.frontendType !== undefined)
|
|
133
170
|
.map(([serviceKey, definition]) => [serviceKey, definition.frontendType]));
|
|
171
|
+
// Backend requests carry public service names; build-time consumers use declaration keys.
|
|
172
|
+
// Validate before publication so two scopes can never silently overwrite one another.
|
|
173
|
+
const frontendServiceNames = {};
|
|
174
|
+
const publicNames = new Set();
|
|
175
|
+
for (const serviceKey of Object.keys(frontendServiceTypes)) {
|
|
176
|
+
const name = config.services[serviceKey]?.serviceName;
|
|
177
|
+
if (!name?.trim() || publicNames.has(name)) {
|
|
178
|
+
throw new Error(`Frontend service "${serviceKey}" needs a unique non-empty public serviceName; received "${name ?? ''}".`);
|
|
179
|
+
}
|
|
180
|
+
publicNames.add(name);
|
|
181
|
+
frontendServiceNames[serviceKey] = name;
|
|
182
|
+
}
|
|
134
183
|
const discoveryContext = buildProviderRuntimeDiscoveryContext({
|
|
135
184
|
discoveredContributions: options?.discoveredContributions,
|
|
136
185
|
frontendServiceTypes,
|
|
@@ -144,6 +193,7 @@ config, options) {
|
|
|
144
193
|
const artifactMetadata = buildArtifactMetadata({
|
|
145
194
|
discoveryContext,
|
|
146
195
|
frontendServiceTypes,
|
|
196
|
+
frontendServiceNames,
|
|
147
197
|
lockSection,
|
|
148
198
|
modules,
|
|
149
199
|
nodeWorkerKeys: options?.nodeWorkerKeys,
|
|
@@ -154,6 +204,7 @@ config, options) {
|
|
|
154
204
|
artifactMetadata,
|
|
155
205
|
discoveryContext,
|
|
156
206
|
frontendServiceTypes,
|
|
207
|
+
frontendServiceNames,
|
|
157
208
|
generatedAt,
|
|
158
209
|
modules,
|
|
159
210
|
nodeWorkerKeys: options?.nodeWorkerKeys,
|
|
@@ -438,18 +489,21 @@ function materializeRuntimeArtifacts(input) {
|
|
|
438
489
|
const nodeWorkerScopes = scopes.workers
|
|
439
490
|
? Object.fromEntries(Object.entries(scopes.workers).filter(([workerKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(workerKey) : true))
|
|
440
491
|
: undefined;
|
|
492
|
+
const backendBootstraps = materializeFrontendProviderBootstraps({
|
|
493
|
+
discoveredContributions: discoveryContext.contributions,
|
|
494
|
+
frontendServiceScopes: scopes.frontendServices ?? {},
|
|
495
|
+
frontendServiceTypes,
|
|
496
|
+
providerConfigurations,
|
|
497
|
+
});
|
|
441
498
|
return pruneUndefined({
|
|
442
499
|
backend: materializeRuntimeArtifactFile({
|
|
443
500
|
artifactKind: 'backend',
|
|
444
501
|
generatedAt,
|
|
445
502
|
modules,
|
|
446
503
|
metadata: artifactMetadata.backend,
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
frontendServiceTypes,
|
|
451
|
-
providerConfigurations,
|
|
452
|
-
}),
|
|
504
|
+
// Only the HTTP-facing backend map uses public names. Static artifacts below
|
|
505
|
+
// deliberately retain declaration keys for build-time scope selection.
|
|
506
|
+
frontendProviderBootstraps: backendBootstraps && Object.fromEntries(Object.entries(backendBootstraps).map(([serviceKey, block]) => [input.frontendServiceNames[serviceKey], block])),
|
|
453
507
|
scope: materializeRuntimeScope(scopes.backend ?? { providers: {}, selection: {} }),
|
|
454
508
|
}),
|
|
455
509
|
companion: materializeRuntimeArtifactFile({
|
|
@@ -502,6 +556,7 @@ function materializeRuntimeArtifactFile(input) {
|
|
|
502
556
|
sourceDigest: input.metadata.sourceDigest,
|
|
503
557
|
providerRefs: input.metadata.providerRefs,
|
|
504
558
|
providerRuntimeImports: input.metadata.providerRuntimeImports,
|
|
559
|
+
systemOfRecordFacetModules: input.metadata.systemOfRecordFacetModules,
|
|
505
560
|
providerGraphDigest: input.metadata.providerGraphDigest,
|
|
506
561
|
lockfileSectionDigest: input.metadata.lockfileSectionDigest,
|
|
507
562
|
artifactKind: input.artifactKind,
|
|
@@ -736,25 +791,38 @@ function buildProviderRuntimeDiscoveryContext(input) {
|
|
|
736
791
|
}
|
|
737
792
|
function buildArtifactMetadata(input) {
|
|
738
793
|
const { discoveryContext, frontendServiceTypes, lockSection, modules, nodeWorkerKeys, scopes, providerConfigurations } = input;
|
|
794
|
+
/*
|
|
795
|
+
* Computed ONCE for every artifact kind, because a vendor facet is not scoped to a runtime the way
|
|
796
|
+
* a provider is: it says what a vendor NEEDS, which does not change between a backend and a
|
|
797
|
+
* minion. Only the backend reads it today (#1055 D2 gives the instance environment to that runtime
|
|
798
|
+
* alone), and recording it everywhere is what keeps that a policy of the RUNTIME rather than a
|
|
799
|
+
* property of the artifact.
|
|
800
|
+
*/
|
|
801
|
+
const systemOfRecordFacetModules = discoverSystemOfRecordFacetModules(discoveryContext.contributions);
|
|
739
802
|
const nodeWorkerKeySet = nodeWorkerKeys ? new Set(nodeWorkerKeys) : undefined;
|
|
740
803
|
return {
|
|
741
804
|
backend: buildSingleScopeArtifactMetadata({
|
|
805
|
+
systemOfRecordFacetModules,
|
|
742
806
|
modules,
|
|
743
807
|
providers: scopes.backend?.providers ?? {},
|
|
744
808
|
matchingContributions: findMatchingDiscoveredContributions({
|
|
745
809
|
discoveredContributions: discoveryContext.contributions,
|
|
746
810
|
matchesRuntimeTarget: discoveryContext.backend.matchesRuntimeTarget,
|
|
747
811
|
}),
|
|
748
|
-
extraArtifactState:
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
812
|
+
extraArtifactState: {
|
|
813
|
+
frontendServiceNames: input.frontendServiceNames,
|
|
814
|
+
bootstraps: buildFrontendProviderBootstrapDigestInput({
|
|
815
|
+
discoveredContributions: discoveryContext.contributions,
|
|
816
|
+
frontendServiceScopes: scopes.frontendServices ?? {},
|
|
817
|
+
frontendServiceTypes,
|
|
818
|
+
providerConfigurations,
|
|
819
|
+
}),
|
|
820
|
+
},
|
|
754
821
|
runtimeLockSection: lockSection.runtimeScopes.backend ?? {},
|
|
755
822
|
scopes,
|
|
756
823
|
}),
|
|
757
824
|
companion: buildSingleScopeArtifactMetadata({
|
|
825
|
+
systemOfRecordFacetModules,
|
|
758
826
|
modules,
|
|
759
827
|
providers: scopes.companion?.providers ?? {},
|
|
760
828
|
matchingContributions: findMatchingDiscoveredContributions({
|
|
@@ -765,6 +833,7 @@ function buildArtifactMetadata(input) {
|
|
|
765
833
|
scopes,
|
|
766
834
|
}),
|
|
767
835
|
frontendServices: buildMultiScopeArtifactMetadata({
|
|
836
|
+
systemOfRecordFacetModules,
|
|
768
837
|
keyedProviders: Object.fromEntries(Object.entries(scopes.frontendServices ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers])),
|
|
769
838
|
matchingContributionsByScope: Object.fromEntries(Object.keys(scopes.frontendServices ?? {}).map((scopeKey) => [
|
|
770
839
|
scopeKey,
|
|
@@ -784,6 +853,7 @@ function buildArtifactMetadata(input) {
|
|
|
784
853
|
scopes,
|
|
785
854
|
}),
|
|
786
855
|
minions: buildMultiScopeArtifactMetadata({
|
|
856
|
+
systemOfRecordFacetModules,
|
|
787
857
|
keyedProviders: Object.fromEntries(Object.entries(scopes.minions ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers])),
|
|
788
858
|
matchingContributionsByScope: Object.fromEntries(Object.keys(scopes.minions ?? {}).map((scopeKey) => [
|
|
789
859
|
scopeKey,
|
|
@@ -797,6 +867,7 @@ function buildArtifactMetadata(input) {
|
|
|
797
867
|
scopes,
|
|
798
868
|
}),
|
|
799
869
|
nodeWorkers: buildMultiScopeArtifactMetadata({
|
|
870
|
+
systemOfRecordFacetModules,
|
|
800
871
|
keyedProviders: Object.fromEntries(Object.entries(scopes.workers ?? {})
|
|
801
872
|
.filter(([scopeKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true)
|
|
802
873
|
.map(([scopeKey, scope]) => [scopeKey, scope.providers])),
|
|
@@ -835,6 +906,7 @@ function buildSingleScopeArtifactMetadata(input) {
|
|
|
835
906
|
}),
|
|
836
907
|
providerRefs,
|
|
837
908
|
providerRuntimeImports: buildProviderRuntimeImports(providerRefs, input.matchingContributions),
|
|
909
|
+
systemOfRecordFacetModules: input.systemOfRecordFacetModules,
|
|
838
910
|
providerGraphDigest: digestJson(providerGraphDigestInput),
|
|
839
911
|
lockfileSectionDigest: digestJson(input.runtimeLockSection),
|
|
840
912
|
};
|
|
@@ -861,10 +933,60 @@ function buildMultiScopeArtifactMetadata(input) {
|
|
|
861
933
|
}),
|
|
862
934
|
providerRefs,
|
|
863
935
|
providerRuntimeImports: buildProviderRuntimeImports(providerRefs, Object.values(input.matchingContributionsByScope).flat()),
|
|
936
|
+
systemOfRecordFacetModules: input.systemOfRecordFacetModules,
|
|
864
937
|
providerGraphDigest: digestJson(providerGraphDigestInput),
|
|
865
938
|
lockfileSectionDigest: digestJson(input.runtimeLockSection),
|
|
866
939
|
};
|
|
867
940
|
}
|
|
941
|
+
/**
|
|
942
|
+
* Which packages ship SYSTEM-OF-RECORD VENDOR FACETS (#1057).
|
|
943
|
+
*
|
|
944
|
+
* ## Read from the MANIFEST, never by loading
|
|
945
|
+
*
|
|
946
|
+
* A package contributes facets by declaring an `./systems-of-record` export — the same door
|
|
947
|
+
* `./companion` is found through, and the same reason: a build-time consumer has no business
|
|
948
|
+
* EVALUATING a vendor facet to learn that one exists. Loading would also make the discovery depend
|
|
949
|
+
* on the package compiling, which is a different question from whether it declares the surface.
|
|
950
|
+
*
|
|
951
|
+
* ## Derived from the contribution walk rather than from a second walk
|
|
952
|
+
*
|
|
953
|
+
* Every candidate package root is already visited to load its companion exports, so the facet
|
|
954
|
+
* question is answered from what that walk found. The consequence, stated because it is a real
|
|
955
|
+
* bound: a package that ships facets and NO provider contributions is not discovered, because
|
|
956
|
+
* nothing would have visited it. That package does not exist today (the catalogue ships 651
|
|
957
|
+
* contributions), and the day one does, this function needs the walk's targets rather than its
|
|
958
|
+
* results — which is a change here and nowhere else.
|
|
959
|
+
*
|
|
960
|
+
* Sorted, so the artifact does not churn on filesystem order, and de-duplicated because one package
|
|
961
|
+
* root contributes hundreds of providers and exactly one facet module.
|
|
962
|
+
*/
|
|
963
|
+
function discoverSystemOfRecordFacetModules(contributions) {
|
|
964
|
+
const specifiers = new Set();
|
|
965
|
+
const visitedRoots = new Set();
|
|
966
|
+
for (const contribution of contributions) {
|
|
967
|
+
const packageRoot = contribution.owner?.packageRoot;
|
|
968
|
+
if (packageRoot === undefined || visitedRoots.has(packageRoot))
|
|
969
|
+
continue;
|
|
970
|
+
visitedRoots.add(packageRoot);
|
|
971
|
+
let manifest;
|
|
972
|
+
try {
|
|
973
|
+
manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf-8'));
|
|
974
|
+
}
|
|
975
|
+
catch {
|
|
976
|
+
// Unreadable or absent: the companion walk already tolerates that, and a package we could not
|
|
977
|
+
// read is not one we can say anything about.
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
if (manifest.exports?.[SYSTEM_OF_RECORD_FACET_SUBPATH] === undefined)
|
|
981
|
+
continue;
|
|
982
|
+
if (typeof manifest.name !== 'string' || manifest.name.length === 0)
|
|
983
|
+
continue;
|
|
984
|
+
specifiers.add(`${manifest.name}${SYSTEM_OF_RECORD_FACET_SUBPATH.slice(1)}`);
|
|
985
|
+
}
|
|
986
|
+
return [...specifiers].sort();
|
|
987
|
+
}
|
|
988
|
+
/** The export a package declares to contribute system-of-record vendor facets. */
|
|
989
|
+
const SYSTEM_OF_RECORD_FACET_SUBPATH = './systems-of-record';
|
|
868
990
|
/**
|
|
869
991
|
* Project the per-ref runtime import path a host dynamic-imports.
|
|
870
992
|
*
|