@wildo-ai/platform-config-lib 1.1.4 → 1.1.6

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.
Files changed (230) hide show
  1. package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
  2. package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +24 -1
  4. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.contracts.js +25 -0
  6. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +117 -1
  8. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  9. package/dist/esm/bootstrap/bootstrap.schemas.js +63 -4
  10. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +24 -1
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +24 -0
  14. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  15. package/dist/esm/bootstrap/platform-store-preconnect.d.ts +37 -0
  16. package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -0
  17. package/dist/esm/bootstrap/platform-store-preconnect.js +43 -0
  18. package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -0
  19. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/runtime-backing-service-access.js +8 -4
  21. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  22. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  23. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  25. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  26. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  27. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +36 -3
  28. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  29. package/dist/esm/bootstrap/runtime-topology.contracts.js +36 -13
  30. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  31. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
  32. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  33. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
  34. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  35. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  36. package/dist/esm/config-authoring.entry.js.map +1 -1
  37. package/dist/esm/index.d.ts +2 -0
  38. package/dist/esm/index.d.ts.map +1 -1
  39. package/dist/esm/index.js +2 -0
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
  42. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
  43. package/dist/esm/lockfile/build-parallelism.js +64 -0
  44. package/dist/esm/lockfile/build-parallelism.js.map +1 -0
  45. package/dist/esm/lockfile/lockfile-io.d.ts +7 -1
  46. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  47. package/dist/esm/lockfile/lockfile-io.js +17 -3
  48. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  49. package/dist/esm/lockfile/materialize-infra-section.d.ts +28 -7
  50. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  51. package/dist/esm/lockfile/materialize-infra-section.js +24 -11
  52. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  53. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +455 -6
  54. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  55. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -0
  56. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  57. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts +13 -0
  58. package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -0
  59. package/dist/esm/project-config/application-public-pricing-catalog.loader.js +56 -0
  60. package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -0
  61. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  62. package/dist/esm/project-config/define-infra-env-config.d.ts +886 -29
  63. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  64. package/dist/esm/project-config/define-infra-env-config.js +395 -16
  65. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  66. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  67. package/dist/esm/project-config/define-minion-config.js +1 -2
  68. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  69. package/dist/esm/project-config/define-saas-config.d.ts +142 -25
  70. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  71. package/dist/esm/project-config/define-saas-config.js +229 -26
  72. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  73. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  74. package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
  75. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
  76. package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
  77. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
  78. package/dist/esm/project-config/index.d.ts +6 -0
  79. package/dist/esm/project-config/index.d.ts.map +1 -1
  80. package/dist/esm/project-config/index.js +6 -0
  81. package/dist/esm/project-config/index.js.map +1 -1
  82. package/dist/esm/project-config/loader.d.ts +35 -0
  83. package/dist/esm/project-config/loader.d.ts.map +1 -1
  84. package/dist/esm/project-config/loader.js +148 -8
  85. package/dist/esm/project-config/loader.js.map +1 -1
  86. package/dist/esm/project-config/npm-version-range.d.ts +23 -0
  87. package/dist/esm/project-config/npm-version-range.d.ts.map +1 -0
  88. package/dist/esm/project-config/npm-version-range.js +175 -0
  89. package/dist/esm/project-config/npm-version-range.js.map +1 -0
  90. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  91. package/dist/esm/project-config/provider-companion-discovery.d.ts +288 -30
  92. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  93. package/dist/esm/project-config/provider-companion-discovery.js +795 -46
  94. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  95. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +192 -20
  96. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  97. package/dist/esm/project-config/provider-runtime-artifacts.js +381 -42
  98. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  99. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  100. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  101. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  102. package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
  103. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  104. package/dist/esm/project-config/shared/auth.schemas.js +14 -35
  105. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  106. package/dist/esm/project-config/shared/backing-service-servability.d.ts +157 -0
  107. package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -0
  108. package/dist/esm/project-config/shared/backing-service-servability.js +256 -0
  109. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -0
  110. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +66 -66
  111. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  112. package/dist/esm/project-config/shared/backing-services.schemas.js +75 -67
  113. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  114. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
  115. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  116. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  117. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  118. package/dist/esm/project-config/shared/csp-emit.js +41 -2
  119. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  120. package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
  121. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  122. package/dist/esm/project-config/shared/csp.schemas.js +11 -12
  123. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  124. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  125. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  126. package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
  127. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  128. package/dist/esm/project-config/shared/environment.schemas.js +186 -9
  129. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  130. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +185 -10
  131. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  132. package/dist/esm/project-config/shared/infra-providers.schemas.js +40 -3
  133. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  134. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  135. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  136. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  137. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  138. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  139. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  140. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  141. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +77 -47
  142. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  143. package/dist/esm/project-config/shared/minion-resource-access.validation.js +114 -52
  144. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  145. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
  146. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  147. package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
  148. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  149. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
  150. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
  151. package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
  152. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
  153. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
  154. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  155. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
  156. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
  157. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
  158. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
  159. package/dist/esm/project-config/static-asset-import-noop.d.ts +26 -0
  160. package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -0
  161. package/dist/esm/project-config/static-asset-import-noop.js +49 -0
  162. package/dist/esm/project-config/static-asset-import-noop.js.map +1 -0
  163. package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
  164. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  165. package/dist/esm/registry/companion-api.schemas.d.ts +0 -176
  166. package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -1
  167. package/dist/esm/registry/companion-api.schemas.js.map +0 -1
  168. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  169. package/dist/esm/registry/index.d.ts +3 -1
  170. package/dist/esm/registry/index.d.ts.map +1 -1
  171. package/dist/esm/registry/index.js +3 -1
  172. package/dist/esm/registry/index.js.map +1 -1
  173. package/dist/esm/registry/local-checkout-source.d.ts +31 -0
  174. package/dist/esm/registry/local-checkout-source.d.ts.map +1 -0
  175. package/dist/esm/registry/local-checkout-source.js +45 -0
  176. package/dist/esm/registry/local-checkout-source.js.map +1 -0
  177. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +174 -14
  178. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  179. package/dist/esm/registry/lockfile-modules-section.schemas.js +120 -11
  180. package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
  181. package/dist/esm/registry/module-artifact.schemas.d.ts +79 -0
  182. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  183. package/dist/esm/registry/module-artifact.schemas.js +36 -0
  184. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  185. package/dist/esm/registry/module-manifest.schemas.d.ts +403 -23
  186. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  187. package/dist/esm/registry/module-manifest.schemas.js +502 -60
  188. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  189. package/dist/esm/registry/module-search.schemas.d.ts +80 -0
  190. package/dist/esm/registry/module-search.schemas.d.ts.map +1 -0
  191. package/dist/esm/registry/module-search.schemas.js +112 -0
  192. package/dist/esm/registry/module-search.schemas.js.map +1 -0
  193. package/dist/esm/registry/registry-config.schemas.d.ts +16 -0
  194. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  195. package/dist/esm/registry/registry-config.schemas.js +8 -0
  196. package/dist/esm/registry/registry-config.schemas.js.map +1 -1
  197. package/dist/esm/registry/registry-errors.d.ts +126 -2
  198. package/dist/esm/registry/registry-errors.d.ts.map +1 -1
  199. package/dist/esm/registry/registry-errors.js +183 -14
  200. package/dist/esm/registry/registry-errors.js.map +1 -1
  201. package/dist/esm/registry/registry-keys.schemas.d.ts +80 -0
  202. package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -0
  203. package/dist/esm/registry/registry-keys.schemas.js +68 -0
  204. package/dist/esm/registry/registry-keys.schemas.js.map +1 -0
  205. package/dist/esm/registry/registry-section-schemas.constants.d.ts +25 -3
  206. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  207. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  208. package/dist/esm/release/framework-release.constants.js.map +1 -1
  209. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  210. package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
  211. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  212. package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
  213. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  214. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  215. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  216. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  217. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  218. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  219. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  220. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +17 -14
  221. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  222. package/dist/esm/workspace-scope/workspace-homes.schemas.js +8 -7
  223. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  224. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
  225. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  226. package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
  227. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  228. package/package.json +7 -7
  229. package/dist/esm/registry/companion-api.schemas.js +0 -165
  230. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -16,11 +16,12 @@
16
16
  * downstream by Phase 5+ verification, not the manifest itself.
17
17
  */
18
18
  import { z } from 'zod';
19
+ import { AppFrontendType, ProviderCatalogueProvenanceSchema, ProviderTier, engineSlotsBoundByCapabilities } from '@wildo-ai/saas-models';
19
20
  /**
20
- * Semver-range schema. Accepts npm-style ranges (`^1.2.0`,
21
- * `~1.2.x`, `>=1.0.0 <2.0.0`, `latest`, `*`, etc.). Phase 5
22
- * resolves these via `semver.satisfies()` at install time; at
23
- * authoring time we only enforce non-empty.
21
+ * Authoring shape for a nonempty version constraint. Registry release selectors
22
+ * can resolve tags; manifest module/framework requirements instead use npm
23
+ * semver ranges and are validated against the receiving application's recorded
24
+ * module versions and installed framework packages before source adoption.
24
25
  */
25
26
  const SemverRange = z.string().min(1).describe('npm-style semver range');
26
27
  /**
@@ -46,24 +47,17 @@ export const ModuleManifestModuleDependenciesSchema = z.record(z.string().min(1)
46
47
  * `dependsOn.npm.dependencies` / `peerDependencies` — npm packages
47
48
  * the installed module imports at runtime. Install surfaces these
48
49
  * to the operator but does not edit `package.json` automatically
49
- * until a future `--with-deps` flow lands (KD-13).
50
+ * or install dependencies. The operator chooses the consuming package (KD-13).
50
51
  */
51
52
  export const ModuleManifestNpmDependenciesSchema = z.strictObject({
52
53
  dependencies: z.record(z.string().min(1), SemverRange).default({}),
53
54
  peerDependencies: z.record(z.string().min(1), SemverRange).default({}),
54
55
  });
55
56
  /**
56
- * `dependsOn.capabilities` — engine/platform capabilities the module
57
- * requires (e.g. `EMAIL_TRANSACTIONAL`, `AI_LLM`). Phase 5+ verifies
58
- * the host app's `engineCapabilities` covers each entry before
59
- * install.
60
- *
61
- * Held as a free-form `string` array because the canonical capability
62
- * vocabulary lives in `@wildo-ai/saas-models`'s
63
- * `EngineCapability` enum. Re-importing that enum here would form
64
- * a `platform-config-lib → saas-models` cycle for a string-list use
65
- * case — Phase 5+ resolves capability names at runtime against the
66
- * registry it does have access to.
57
+ * `dependsOn.capabilities` — required EngineCapability names. Adoption validates
58
+ * each name against the canonical enum and requires enabled:true in the host's
59
+ * authored engineCapabilities. This proves declared activation, not provider
60
+ * health. Strings remain the artifact format; the CLI performs host comparison.
67
61
  */
68
62
  export const ModuleManifestCapabilityDependenciesSchema = z.array(z.string().min(1));
69
63
  export const ModuleManifestDependenciesSchema = z.strictObject({
@@ -77,79 +71,527 @@ export const ModuleManifestDependenciesSchema = z.strictObject({
77
71
  /**
78
72
  * Engine compatibility — the framework version range this module
79
73
  * targets. Install hard-fails by default if the host app's framework
80
- * version is outside the range.
74
+ * version is outside the range. Every installed saas-models copy reached from
75
+ * application workspace framework dependencies must satisfy it; desired pins
76
+ * and the running CLI version are not installed application evidence.
81
77
  */
82
78
  export const ModuleManifestEngineSchema = z.strictObject({
83
79
  framework: SemverRange,
84
80
  });
85
81
  /**
86
- * 6th-pass M5: each entry in a `boundaries.*` array must be a
87
- * RELATIVE path with no `..` segments. Without this refine:
88
- * - `path.resolve(saasRoot, '/abs/path')` returns `/abs/path` on
89
- * POSIX (absolute argument resets the resolve chain), so the
90
- * boundary check fails for every candidate file → publish
91
- * surfaces a confusing "outside boundary" error when the real
92
- * problem is the boundary itself being malformed.
93
- * - `'../../escape'` could legitimately resolve inside `saasRoot`
94
- * after normalization, but the publisher intent is unclear and
95
- * downstream zip-slip / symlink-escape guards become harder to
96
- * reason about. Reject at parse time with a precise message.
97
- */
98
- const RelativeBoundaryPathSchema = z
99
- .string()
100
- .min(1)
101
- .refine((s) => {
102
- // Reject absolute paths (POSIX `/...`, Windows `C:\...` or `\\server\...`).
103
- if (/^([a-zA-Z]:|[\\/])/.test(s))
104
- return false;
105
- // Reject `..` segments after normalizing path separators.
106
- const segments = s.split(/[\\/]/);
107
- return !segments.includes('..');
108
- }, {
109
- error: 'boundary entries must be relative to the saas root and contain no `..` segments ' +
110
- '(e.g. `app/src/modules/acme-billing`, NOT `/app/src/modules/acme-billing` or `../escape`)',
82
+ * One registry NAME segment — a domain slug, or either half of a module id. Lowercase ASCII letters,
83
+ * digits, `.`, `_`, `-`, not starting with `.`, `_` or `-` (npm's package-name alphabet).
84
+ *
85
+ * These names are not only identifiers: the CLI builds filesystem paths from them
86
+ * (`.wildo-saas/generated/modules-artifacts/<domain>/<scope>/<name>/…`) and runs a RECURSIVE delete
87
+ * on those paths to wipe a stale staging or extraction tree. Until 2026-09-25 the only rule on a
88
+ * module id was "contains a `/`", so a manifest `id` of `a/../../../..` made `wildo registry publish`
89
+ * resolve its staging root to the application root and delete it. The rule is total over both
90
+ * places a name is authored: a module's manifest, and a domain created on the registry server.
91
+ */
92
+ const REGISTRY_NAME_SEGMENT_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
93
+ const REGISTRY_NAME_SEGMENT_MAX_LENGTH = 64;
94
+ function isRegistryNameSegment(segment) {
95
+ return segment.length <= REGISTRY_NAME_SEGMENT_MAX_LENGTH && REGISTRY_NAME_SEGMENT_REGEX.test(segment);
96
+ }
97
+ /** A registry domain slug (`acme`, `internal`) — one {@link isRegistryNameSegment} segment. */
98
+ export const RegistryDomainSlugSchema = z.string().refine(isRegistryNameSegment, {
99
+ error: 'a registry domain must be lowercase letters, digits, `.`, `_` or `-`, starting with a letter or digit (max 64)',
111
100
  });
101
+ /** Whether `moduleId` is a well-formed `<scope>/<name>` module id. */
102
+ export function isModuleId(moduleId) {
103
+ const segments = moduleId.split('/');
104
+ return segments.length === 2 && segments.every(isRegistryNameSegment);
105
+ }
106
+ /**
107
+ * A module id: exactly `<scope>/<name>` (e.g. `acme/billing`), each half a registry name segment.
108
+ * The id is also the lockfile key, the registry URL segment, and — through the CLI — a directory
109
+ * path, so its shape is the path-safety rule, not a style preference.
110
+ */
111
+ export const ModuleIdSchema = z.string().refine(isModuleId, {
112
+ error: 'a module id must be `<scope>/<name>` (e.g. `acme/billing`), each half lowercase letters, digits, `.`, `_` or `-`',
113
+ });
114
+ /**
115
+ * Where each layer's MODULE directories live in a Wildo SaaS application, relative to its root.
116
+ *
117
+ * Derived from the scaffold, not invented: the `add-module` scenario creates a module's directories
118
+ * under `shared-lib/src/modules/<id>`, `specifications/src/modules/<id>`, `frontend/src/modules/<id>`
119
+ * and `backend-api/src/modules/<id>`; `add-minion` and `add-worker-node` create a package directory
120
+ * under `minions/<dir>` and `workers/<dir>`.
121
+ *
122
+ * A registry module may write only BELOW one of these roots, in a directory it names. That is the
123
+ * whole of KD-12, stated positively. Until 2026-09-25 the boundary rule refused only absolute paths
124
+ * and `..` segments, so `.`, `.git/hooks`, `.wildo-saas` and `wildo.saas.config.ts` were all valid
125
+ * boundaries: a published module could overwrite the host's configuration or plant a git hook, and
126
+ * `wildo registry publish` would ship the author's `.env` and `secrets.json`.
127
+ */
128
+ export const MODULE_BOUNDARY_LAYER_ROOTS = {
129
+ specifications: 'specifications/src/modules',
130
+ shared: 'shared-lib/src/modules',
131
+ frontend: 'frontend/src/modules',
132
+ backend: 'backend-api/src/modules',
133
+ minions: 'minions',
134
+ workers: 'workers',
135
+ /**
136
+ * A PROVIDER module's directory, `providers/<ref>` (#2014), holding one workspace package per facet
137
+ * (`providers/<ref>/backend`, `providers/<ref>/frontend`). Like a minion or a worker, each facet is its
138
+ * own package, so the root is a top-level directory rather than a layer's `src/modules`: the facet's own
139
+ * `package.json` is where its vendor SDK dependency lives, and a runtime depends only on the facet it runs.
140
+ */
141
+ providers: 'providers',
142
+ };
143
+ /** Every boundary layer, in the canonical order of {@link MODULE_BOUNDARY_LAYER_ROOTS}. */
144
+ export const MODULE_BOUNDARY_LAYERS = Object.keys(MODULE_BOUNDARY_LAYER_ROOTS);
112
145
  /**
113
- * `boundaries` — the per-layer surface the module is allowed to
114
- * write into the host app source (KD-12). Paths are relative to the
115
- * saas root; install rejects artifacts that attempt to write outside
116
- * any declared boundary.
146
+ * Directory names a module artifact may never contain, at any depth: dependency installs are the
147
+ * consumer's to produce, never the publisher's to ship.
148
+ */
149
+ const MODULE_ARTIFACT_FORBIDDEN_SEGMENTS = new Set(['node_modules']);
150
+ /**
151
+ * Whether one `/`-separated path segment may appear in a module boundary or a module artifact.
117
152
  *
118
- * Each layer is optional; modules typically declare only the layers
119
- * they actually contain (a backend-only module declares `backend`
120
- * + `shared` and omits `frontend` / `specifications`).
153
+ * A DOT-prefixed segment is refused outright. That single rule removes `.git` (hooks run code on the
154
+ * next commit), `.env` (a minion or worker package carries its generated secrets there),
155
+ * `.wildo-saas` (the companion and machine-local state) and `..` / `.` (traversal and "the whole
156
+ * root"). npm applies the same default for the same reason: `.git` and the like never enter a
157
+ * published package.
158
+ */
159
+ function isAllowedModulePathSegment(segment) {
160
+ return segment.length > 0 && !segment.startsWith('.') && !MODULE_ARTIFACT_FORBIDDEN_SEGMENTS.has(segment);
161
+ }
162
+ /**
163
+ * Whether `appRelativePath` (POSIX separators, relative to the application root) may be carried by a
164
+ * module artifact. Used on BOTH sides of the registry so they cannot disagree:
165
+ *
166
+ * - `wildo registry publish` skips a file that fails it, so a secret beside the module's source is
167
+ * never packed;
168
+ * - `wildo registry add` / `update` / `repair` refuse an artifact containing one, before writing
169
+ * anything — a correctly published artifact cannot contain it, so its presence means the bytes
170
+ * did not come from `publish`.
171
+ */
172
+ export function isModuleArtifactPathAllowed(appRelativePath) {
173
+ if (appRelativePath.includes('\\') || appRelativePath.startsWith('/'))
174
+ return false;
175
+ return appRelativePath.split('/').every(isAllowedModulePathSegment);
176
+ }
177
+ /**
178
+ * Whether `appRelativePath` is a file a registry module can OWN in an application: a path a module
179
+ * artifact may carry ({@link isModuleArtifactPathAllowed}) that also sits strictly below one of the
180
+ * layer roots ({@link MODULE_BOUNDARY_LAYER_ROOTS}) — because an install only ever writes inside a
181
+ * boundary, and every boundary lives there.
182
+ *
183
+ * This is the rule for a path RECORDED as installed (`sections.modules.installed[*].files`), which
184
+ * `remove` and `update` delete. `isModuleArtifactPathAllowed` alone would let a hand-edited or badly
185
+ * merged entry name `wildo.saas.config.ts` or `backend-api/src/index.ts`, and removing the module would
186
+ * then delete the application's own file.
187
+ */
188
+ export function isModuleOwnedFilePath(appRelativePath) {
189
+ return isModuleArtifactPathAllowed(appRelativePath)
190
+ && Object.values(MODULE_BOUNDARY_LAYER_ROOTS).some((root) => appRelativePath.startsWith(`${root}/`));
191
+ }
192
+ /**
193
+ * One layer's `boundaries` entries: each a directory strictly BELOW that layer's root
194
+ * ({@link MODULE_BOUNDARY_LAYER_ROOTS}), written with POSIX separators, every segment allowed by
195
+ * {@link isModuleArtifactPathAllowed}. Validated at parse time, so the registry server refuses a
196
+ * manifest declaring a wider boundary at publish and the CLI refuses one at install.
197
+ */
198
+ function moduleLayerBoundariesSchema(layer) {
199
+ const root = MODULE_BOUNDARY_LAYER_ROOTS[layer];
200
+ return z.array(z.string().min(1).refine((entry) => isModuleArtifactPathAllowed(entry) && entry.startsWith(`${root}/`) && entry.length > root.length + 1, {
201
+ error: `boundaries.${layer} entries must name a directory below \`${root}/\` (e.g. \`${root}/acme-billing\`), ` +
202
+ 'with `/` separators and no segment that starts with `.` or is `node_modules`',
203
+ })).default([]);
204
+ }
205
+ /**
206
+ * `boundaries` — the per-layer surface the module is allowed to write into the host app source
207
+ * (KD-12). Each layer is optional; modules typically declare only the layers they actually contain
208
+ * (a backend-only module declares `backend` + `shared` and omits `frontend` / `specifications`).
121
209
  */
122
210
  export const ModuleManifestBoundariesSchema = z.strictObject({
123
- specifications: z.array(RelativeBoundaryPathSchema).default([]),
124
- shared: z.array(RelativeBoundaryPathSchema).default([]),
125
- frontend: z.array(RelativeBoundaryPathSchema).default([]),
126
- backend: z.array(RelativeBoundaryPathSchema).default([]),
127
- minions: z.array(RelativeBoundaryPathSchema).default([]),
128
- workers: z.array(RelativeBoundaryPathSchema).default([]),
211
+ specifications: moduleLayerBoundariesSchema('specifications'),
212
+ shared: moduleLayerBoundariesSchema('shared'),
213
+ frontend: moduleLayerBoundariesSchema('frontend'),
214
+ backend: moduleLayerBoundariesSchema('backend'),
215
+ minions: moduleLayerBoundariesSchema('minions'),
216
+ workers: moduleLayerBoundariesSchema('workers'),
217
+ providers: moduleLayerBoundariesSchema('providers'),
129
218
  });
219
+ /**
220
+ * The boundaries schema declares every layer of {@link MODULE_BOUNDARY_LAYER_ROOTS} and nothing else: a
221
+ * root added without its boundaries key (or the reverse) fails to compile here.
222
+ */
223
+ export const BOUNDARIES_SCHEMA_COVERS_EVERY_LAYER = true;
224
+ /**
225
+ * Every boundary directory a manifest declares, across ALL layers, in canonical layer order.
226
+ *
227
+ * The one place a consumer turns `boundaries` into a list. Three consumers (the packager, `publish`, the
228
+ * install fan-out) each used to spell the six layers out by hand, so a seventh layer — `providers`,
229
+ * #2014 — would have been silently skipped by all three: an artifact that packs nothing, an install that
230
+ * copies nothing, and a publish that reports success. Iterating the roots makes the next layer impossible
231
+ * to forget.
232
+ */
233
+ export function flattenModuleBoundaries(boundaries) {
234
+ if (!boundaries)
235
+ return [];
236
+ return MODULE_BOUNDARY_LAYERS.flatMap((layer) => boundaries[layer] ?? []);
237
+ }
238
+ /**
239
+ * How an installed module is REGISTERED in the host application — the composition scenario whose
240
+ * registry edits make it a module the application knows about (#1755, #1773).
241
+ *
242
+ * Installing copies a module's files; registering it adds it to what the application declares. Without
243
+ * registration the backend discovers `backend-api/src/modules/<dir>` by directory scan while every other
244
+ * layer ignores the module, and a minion or worker is never declared at all, so it never runs.
245
+ *
246
+ * Each member is the framework scenario that IS the declaration of how that shape is registered, so
247
+ * installation replays its edit steps rather than keeping a second copy of them:
248
+ */
249
+ export var ModuleRegistrationScenario;
250
+ (function (ModuleRegistrationScenario) {
251
+ /** A domain module — its shared, specifications and frontend registries and `applicationModules`. */
252
+ ModuleRegistrationScenario["ADD_MODULE"] = "add-module";
253
+ /** A minion — `applicationMinions`, its provider scope, and the pnpm workspace member. */
254
+ ModuleRegistrationScenario["ADD_MINION"] = "add-minion";
255
+ /** A worker node — `applicationWorkers`, its provider scope, and the pnpm workspace member. */
256
+ ModuleRegistrationScenario["ADD_WORKER_NODE"] = "add-worker-node";
257
+ /**
258
+ * A provider module (#2014): the pnpm workspace member, each facet package as a `workspace:*` dependency of the
259
+ * runtimes that own that facet, and the provider's scope in each. Unlike the three above it is never carried by a
260
+ * MANIFEST: the owners are the INSTALLING application's, so the installer derives the wiring and only its lockfile
261
+ * records it ({@link ProviderWiringSchema}).
262
+ */
263
+ ModuleRegistrationScenario["ADD_PROVIDER_PACKAGE"] = "add-provider-package";
264
+ })(ModuleRegistrationScenario || (ModuleRegistrationScenario = {}));
265
+ /**
266
+ * An application-relative service directory as `wildo.saas.config.ts` declares it (`./backend-api`, `frontend`).
267
+ * Restricted to plain path segments, with no `..`, because a wiring names files the installer and `remove` edit.
268
+ */
269
+ const WIRED_SERVICE_PATH_PATTERN = /^(\.\/)?(?!\.\.?(\/|$))[A-Za-z0-9_-][A-Za-z0-9._-]*(\/(?!\.\.?(\/|$))[A-Za-z0-9_-][A-Za-z0-9._-]*)*$/;
270
+ /** A scoped provider facet package name: `@<scope>/provider-<ref>` or `@<scope>/provider-<ref>-frontend`. */
271
+ const PROVIDER_FACET_PACKAGE_NAME_PATTERN = /^@[a-z0-9][a-z0-9._-]*\/provider-[a-z][a-z0-9-]*$/;
272
+ /** One runtime a provider facet was wired into: its key in `services`, and its directory. */
273
+ export const ProviderWiringOwnerSchema = z.strictObject({
274
+ serviceKey: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/),
275
+ path: z.string().regex(WIRED_SERVICE_PATH_PATTERN),
276
+ });
277
+ /**
278
+ * What an `add-provider-package` install wired, as the INSTALLER derived it from its own application (#2014):
279
+ * - `backendOwners`: the backend services that depend on the backend facet and scope the provider;
280
+ * - `frontendOwners`: the frontend services, of a type in the facet's `surfaces`, that depend on the browser facet
281
+ * and scope the provider.
282
+ *
283
+ * Recorded so `remove` reverses exactly what install wrote, even after the application's services change.
284
+ */
285
+ export const ProviderWiringSchema = z.strictObject({
286
+ /** The backend facet's package name as installed (`@<scope>/provider-<ref>`); absent without a backend facet. */
287
+ backendPackage: z.string().regex(PROVIDER_FACET_PACKAGE_NAME_PATTERN).optional(),
288
+ backendOwners: z.array(ProviderWiringOwnerSchema),
289
+ /** The browser facet's package name as installed; absent without a frontend facet. */
290
+ frontendPackage: z.string().regex(PROVIDER_FACET_PACKAGE_NAME_PATTERN).optional(),
291
+ frontendOwners: z.array(ProviderWiringOwnerSchema),
292
+ });
293
+ /**
294
+ * The four layers of a domain module, named as its manifest boundaries name them. A domain-module
295
+ * registration may cover a SUBSET (#1773): a backend+shared module registers its shared entries and an
296
+ * `applicationModules` entry bound to the backend only.
297
+ */
298
+ export var DomainModuleLayer;
299
+ (function (DomainModuleLayer) {
300
+ DomainModuleLayer["SHARED"] = "shared";
301
+ DomainModuleLayer["SPECIFICATIONS"] = "specifications";
302
+ DomainModuleLayer["FRONTEND"] = "frontend";
303
+ DomainModuleLayer["BACKEND"] = "backend";
304
+ })(DomainModuleLayer || (DomainModuleLayer = {}));
305
+ /**
306
+ * Every domain layer is a boundary layer, spelled the same (#1773 review): the enum restates four keys of
307
+ * `MODULE_BOUNDARY_LAYER_ROOTS`, so a member added or renamed on one side alone fails to compile here.
308
+ */
309
+ export const DOMAIN_LAYERS_ARE_BOUNDARY_LAYERS = true;
310
+ /** Canonical order, so one set of layers has one spelling. */
311
+ export const DOMAIN_MODULE_LAYERS = [
312
+ DomainModuleLayer.SHARED,
313
+ DomainModuleLayer.SPECIFICATIONS,
314
+ DomainModuleLayer.FRONTEND,
315
+ DomainModuleLayer.BACKEND,
316
+ ];
317
+ /**
318
+ * The scenarios' variable patterns for the directory and camelCase stem their REGISTRY edits use
319
+ * (`moduleId`/`moduleCamel`, `minionDir`/`minionCamel`, `workerDir`/`workerCamel` share them). Mirrored
320
+ * here because the manifest is validated where no scenario is loaded (the registry server); a test pins
321
+ * them equal to the scenarios' own declarations.
322
+ */
323
+ export const MODULE_REGISTRATION_MODULE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
324
+ export const MODULE_REGISTRATION_MODULE_CAMEL_PATTERN = /^[a-z][A-Za-z0-9]*$/;
325
+ /**
326
+ * A module's registration: the scenario plus the ONLY values its registry edits read. It carries no
327
+ * code — the installer renders the scenario's own edit steps with these values, both restricted to
328
+ * identifier alphabets (and anything else a scenario needs is DERIVED by the installer, never read from
329
+ * the manifest) — so a manifest cannot smuggle text into the host's files. Derived by
330
+ * `wildo registry publish` from the publishing application (every edit already present), never authored.
331
+ */
332
+ export const ModuleManifestRegistrationSchema = z
333
+ .strictObject({
334
+ scenario: z.enum(ModuleRegistrationScenario),
335
+ /** The module's directory under its scenario's root: each layer's modules root, `minions/` or `workers/` (kebab-case). */
336
+ moduleId: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN),
337
+ /** The camelCase stem the scenario's entries are named from (`<stem>Module`, the minion/worker bucket key). */
338
+ moduleCamel: z.string().regex(MODULE_REGISTRATION_MODULE_CAMEL_PATTERN),
339
+ /**
340
+ * `add-module` only: the layers the module covers, when it is NOT all four (absent = the whole module,
341
+ * so one module has one spelling). Must include `backend` or `frontend`: an `applicationModules` entry
342
+ * binds the module to at least one service.
343
+ */
344
+ layers: z.array(z.enum(DomainModuleLayer)).min(1).optional(),
345
+ /** `add-provider-package` only, and required there: what the installer wired. */
346
+ providerWiring: ProviderWiringSchema.optional(),
347
+ })
348
+ .superRefine((registration, context) => {
349
+ const isProviderWiring = registration.scenario === ModuleRegistrationScenario.ADD_PROVIDER_PACKAGE;
350
+ if (isProviderWiring !== (registration.providerWiring !== undefined)) {
351
+ context.addIssue({ code: 'custom', path: ['providerWiring'], message: 'an add-provider-package registration carries its wiring, and no other registration does' });
352
+ }
353
+ const layers = registration.layers;
354
+ if (layers === undefined)
355
+ return;
356
+ if (registration.scenario !== ModuleRegistrationScenario.ADD_MODULE) {
357
+ context.addIssue({ code: 'custom', path: ['layers'], message: 'only an add-module registration covers layers' });
358
+ return;
359
+ }
360
+ const canonical = DOMAIN_MODULE_LAYERS.filter((layer) => layers.includes(layer));
361
+ if (canonical.length !== layers.length || canonical.some((layer, index) => layer !== layers[index])) {
362
+ context.addIssue({ code: 'custom', path: ['layers'], message: `layers must be distinct and in canonical order (${DOMAIN_MODULE_LAYERS.join(', ')})` });
363
+ }
364
+ if (canonical.length === DOMAIN_MODULE_LAYERS.length) {
365
+ context.addIssue({ code: 'custom', path: ['layers'], message: 'a whole module omits `layers`' });
366
+ }
367
+ if (!layers.includes(DomainModuleLayer.BACKEND) && !layers.includes(DomainModuleLayer.FRONTEND)) {
368
+ context.addIssue({ code: 'custom', path: ['layers'], message: 'a registered module must include the backend or the frontend layer' });
369
+ }
370
+ });
371
+ /**
372
+ * What a registry module IS: the one discriminator every consumer branches on (#2014).
373
+ *
374
+ * The registry was built to carry application FEATURES. On 2026-09-29 Paul decided it also carries
375
+ * PROVIDERS, distributed shadcn-style: a provider's source is copied into the application, which owns it
376
+ * from then on. The Activepieces/Sim-generated catalogue that used to hold providers is archived (#2012).
377
+ * The two kinds differ in what they may contain and in how they are registered, so the difference is
378
+ * named rather than inferred from which boundaries happen to be present.
379
+ */
380
+ export var ModuleKind;
381
+ (function (ModuleKind) {
382
+ /**
383
+ * An application feature: domain module layers, a minion or a worker. Every module published before
384
+ * #2014 is one, which is why a manifest that omits `kind` reads as FEATURE.
385
+ */
386
+ ModuleKind["FEATURE"] = "feature";
387
+ /**
388
+ * One vendor's integration, installed at `providers/<ref>/` with ONE workspace package per facet
389
+ * ({@link ProviderModuleFacet}): each carries its own SDK dependencies in its own `package.json`, and
390
+ * each runtime depends only on the facet it runs. It may fill an engine capability when its tier is
391
+ * EXTENSION.
392
+ *
393
+ * What a provider module never is:
394
+ * - system-of-record facets: a separate lane, delivered by `@wildo-ai/systems-of-record` (#2013);
395
+ * - an INFRASTRUCTURE provider (object storage, databases, brokers, scanners): those are executed by the
396
+ * PLATFORM (apps-manager) with platform administrator credentials, so application-owned code must never
397
+ * be one. They stay in the platform's own package, selected by the application's declaration (#1692).
398
+ */
399
+ ModuleKind["PROVIDER"] = "provider";
400
+ })(ModuleKind || (ModuleKind = {}));
401
+ /**
402
+ * The runtime facets a provider module can ship, each as its own workspace package under
403
+ * `providers/<ref>/<facet>/` (Paul, 2026-09-29).
404
+ *
405
+ * One package per facet, as the engine itself separates `external-connectors-private` (backend) from
406
+ * `external-connectors-public` (browser):
407
+ * - a Node SDK never reaches a frontend install, and a browser SDK never reaches a backend's;
408
+ * - each runtime owner depends on exactly the facet it runs, so imports stay unambiguous;
409
+ * - the browser facet cannot reach backend code unless its own manifest declares that dependency, which
410
+ * publish refuses. Isolation is a property of the dependency graph, not of scanning import statements.
411
+ *
412
+ * There is deliberately no INFRASTRUCTURE member: see {@link ModuleKind.PROVIDER}.
413
+ */
414
+ export var ProviderModuleFacet;
415
+ (function (ProviderModuleFacet) {
416
+ /** Loaded by the application backend, the companion and minions. Workers load no providers. */
417
+ ProviderModuleFacet["BACKEND"] = "backend";
418
+ /** Loaded by the frontend services whose type is listed in its `surfaces`. */
419
+ ProviderModuleFacet["FRONTEND"] = "frontend";
420
+ })(ProviderModuleFacet || (ProviderModuleFacet = {}));
421
+ /**
422
+ * How far a published provider has been taken since it was adopted (#2012).
423
+ *
424
+ * There is deliberately no SEEDED member: a seed (a catalogue transposition in the archive) is never
425
+ * published, so the registry only ever holds providers someone adopted.
426
+ */
427
+ export var ProviderModuleMaturity;
428
+ (function (ProviderModuleMaturity) {
429
+ /** Copied from a seed or written by hand, reviewed, and owned by Wildo. Not yet met the real vendor. */
430
+ ProviderModuleMaturity["ADOPTED"] = "adopted";
431
+ /** Has executed against the real vendor it names, with the proof recorded on the tracker. */
432
+ ProviderModuleMaturity["PROVEN"] = "proven";
433
+ })(ProviderModuleMaturity || (ProviderModuleMaturity = {}));
434
+ /**
435
+ * The tiers a PROVIDER module may declare. MAIN is the engine's own set: its origin is always ENGINE,
436
+ * and the tier rule (`provider-tier-rule.shared.utils.ts`) refuses MAIN from anywhere else.
437
+ */
438
+ const PROVIDER_MODULE_TIERS = [ProviderTier.CATALOGUE, ProviderTier.EXTENSION];
439
+ /**
440
+ * The `provider` block of a PROVIDER module: what the registry must know about the provider WITHOUT
441
+ * executing its code, which is what server-side search and listing need.
442
+ *
443
+ * Deliberately NOT carried here, so there is one source for each fact:
444
+ * - the ENGINE capabilities it fills: derived from `providerCapabilities` through the same closed map the
445
+ * engine uses (`engineSlotsBoundByCapabilities`);
446
+ * - the compliance profile, secrets contract, operations and auth: they live in the module's code
447
+ * (`BackendProviderModule`), which discovery already reads. Publish checks that this block agrees
448
+ * with that code (#2014).
449
+ *
450
+ * Fields for per-provider skills, OpenAPI binding and change monitoring are added by the issues that
451
+ * read them (#2026, #2028, #2027), not before.
452
+ */
453
+ export const ModuleManifestProviderSchema = z
454
+ .strictObject({
455
+ /**
456
+ * The provider ref: the application's scope key, the directory under `providers/`, and the suffix of
457
+ * the package name. One kebab-case segment, the same alphabet as a registration directory.
458
+ */
459
+ ref: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN),
460
+ /** The vendor's identity, shared by every ref of one vendor. Defaults to the ref, as provider metadata does. */
461
+ vendor: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN).optional(),
462
+ /** CATALOGUE (operations only) or EXTENSION (fills an engine capability). */
463
+ tier: z.enum(PROVIDER_MODULE_TIERS),
464
+ /** The provider capability tokens the module declares, as its `BackendProviderModule` does. */
465
+ providerCapabilities: z.array(z.string().min(1)).default([]),
466
+ /**
467
+ * The facets the module ships, each a package at `providers/<ref>/<facet>/`. At least one.
468
+ * Keys are {@link ProviderModuleFacet} members.
469
+ */
470
+ facets: z.strictObject({
471
+ [ProviderModuleFacet.BACKEND]: z.strictObject({}).optional(),
472
+ [ProviderModuleFacet.FRONTEND]: z
473
+ .strictObject({
474
+ /**
475
+ * Which frontend surfaces the browser facet serves: the application, the public website, the
476
+ * documentation site. Installation adds the facet's package only to frontend services of these
477
+ * types. The engine composes a separate provider registry per surface, which is why it is named.
478
+ */
479
+ surfaces: z.array(z.enum(AppFrontendType)).min(1),
480
+ })
481
+ .optional(),
482
+ }),
483
+ maturity: z.enum(ProviderModuleMaturity),
484
+ /** Where the adopted source came from, when it came from a catalogue seed. */
485
+ seed: ProviderCatalogueProvenanceSchema.optional(),
486
+ })
487
+ .superRefine((provider, context) => {
488
+ if (providerModuleFacets(provider).length === 0) {
489
+ context.addIssue({ code: 'custom', path: ['facets'], message: 'a provider module ships a backend facet, a frontend facet, or both' });
490
+ }
491
+ const surfaces = provider.facets[ProviderModuleFacet.FRONTEND]?.surfaces ?? [];
492
+ if (new Set(surfaces).size !== surfaces.length) {
493
+ context.addIssue({ code: 'custom', path: ['facets', ProviderModuleFacet.FRONTEND, 'surfaces'], message: 'each frontend surface is listed once' });
494
+ }
495
+ const boundSlots = engineSlotsBoundByCapabilities(provider.providerCapabilities);
496
+ if (provider.tier === ProviderTier.CATALOGUE && boundSlots.length > 0) {
497
+ context.addIssue({
498
+ code: 'custom',
499
+ path: ['providerCapabilities'],
500
+ message: `tier CATALOGUE may claim only open capability tokens, but ${boundSlots.map((entry) => `"${entry.capability}" binds the ${entry.slot} engine slot`).join(', ')}. `
501
+ + 'Declare EXTENSION to fill an engine capability.',
502
+ });
503
+ }
504
+ if (provider.tier === ProviderTier.EXTENSION && boundSlots.length === 0) {
505
+ context.addIssue({
506
+ code: 'custom',
507
+ path: ['providerCapabilities'],
508
+ message: 'tier EXTENSION fills an engine capability, so at least one provider capability must bind an engine slot',
509
+ });
510
+ }
511
+ });
512
+ /**
513
+ * The facets a provider module ships, in canonical enum order, and the package directory of each.
514
+ * Install, publish and registration all read these rather than re-deriving the layout.
515
+ */
516
+ export function providerModuleFacets(provider) {
517
+ return Object.values(ProviderModuleFacet).filter((facet) => provider.facets[facet] !== undefined);
518
+ }
519
+ /** `providers/<ref>/<facet>`: where one facet's workspace package lives. */
520
+ export function providerModuleFacetDirectory(ref, facet) {
521
+ return `${MODULE_BOUNDARY_LAYER_ROOTS.providers}/${ref}/${facet}`;
522
+ }
523
+ /** The engine capabilities a provider module fills, derived rather than declared. */
524
+ export function engineCapabilitiesFilledByProviderModule(provider) {
525
+ return [...new Set(engineSlotsBoundByCapabilities(provider.providerCapabilities).map((entry) => entry.slot))];
526
+ }
527
+ /** The file a module's manifest lives in: at the root of every artifact, of a checkout module, and of a publishing application. */
528
+ export const MODULE_MANIFEST_FILE_NAME = 'wildo.module.json';
130
529
  /**
131
530
  * Top-level manifest. Stored at `wildo.module.json` inside every
132
531
  * artifact zip and at the registry server alongside its version row.
133
532
  *
134
- * `id` semantics: `<domain>/<name>` (e.g. `acme/billing`) where the
135
- * domain is the registry domain and `name` is locally unique within
136
- * the domain. The id is reused as the lockfile entry key
533
+ * `id` semantics: `<scope>/<name>` (e.g. `acme/billing`), separate
534
+ * from the registry domain (e.g. `internal`). The id is reused as the lockfile entry key
137
535
  * (`sections.modules.installed[<id>]`).
138
536
  */
139
537
  export const ModuleManifestSchema = z.object({
140
- id: z.string().min(1),
538
+ id: ModuleIdSchema,
141
539
  version: SemverExact,
540
+ /** What the module is. Absent reads as FEATURE: every module published before #2014 is one. */
541
+ kind: z.enum(ModuleKind).default(ModuleKind.FEATURE),
542
+ /** Present exactly when `kind` is PROVIDER. */
543
+ provider: ModuleManifestProviderSchema.optional(),
142
544
  description: z.string().optional(),
143
545
  /** Free-form description of what the module ships, for `wildo registry info`. */
144
546
  longDescription: z.string().optional(),
145
547
  engine: ModuleManifestEngineSchema.optional(),
146
548
  boundaries: ModuleManifestBoundariesSchema.optional(),
147
549
  dependsOn: ModuleManifestDependenciesSchema.optional(),
550
+ /** How the module is registered in a host application — see {@link ModuleManifestRegistrationSchema}. */
551
+ registration: ModuleManifestRegistrationSchema.optional(),
148
552
  /**
149
553
  * Free-form key/value bag for non-load-bearing metadata
150
554
  * (homepage, license, repository). Phase 1 keeps it open;
151
555
  * Phase 6 may tighten it for `wildo registry publish` UX.
152
556
  */
153
557
  meta: z.record(z.string().min(1), z.unknown()).optional(),
154
- }).catchall(z.unknown());
558
+ }).catchall(z.unknown()).superRefine((manifest, context) => {
559
+ const providerBoundaries = manifest.boundaries?.providers ?? [];
560
+ if (manifest.kind !== ModuleKind.PROVIDER) {
561
+ if (manifest.provider !== undefined) {
562
+ context.addIssue({ code: 'custom', path: ['provider'], message: 'only a module of kind `provider` carries a provider block' });
563
+ }
564
+ if (providerBoundaries.length > 0) {
565
+ context.addIssue({ code: 'custom', path: ['boundaries', 'providers'], message: 'only a module of kind `provider` writes below `providers/`' });
566
+ }
567
+ return;
568
+ }
569
+ if (manifest.provider === undefined) {
570
+ context.addIssue({ code: 'custom', path: ['provider'], message: 'a module of kind `provider` carries a provider block' });
571
+ return;
572
+ }
573
+ // A provider's owners are the INSTALLING application's, so the installer derives its wiring (#2014). A manifest
574
+ // that carried one would be telling an installer which of its files to edit.
575
+ if (manifest.registration !== undefined) {
576
+ context.addIssue({ code: 'custom', path: ['registration'], message: 'a provider module carries no registration: each installing application derives its own wiring' });
577
+ }
578
+ // A provider module IS one package directory: exactly `providers/<ref>`, and nothing in any other layer,
579
+ // so installing it can never write into the application's own modules, minions or workers.
580
+ const expected = `${MODULE_BOUNDARY_LAYER_ROOTS.providers}/${manifest.provider.ref}`;
581
+ if (providerBoundaries.length !== 1 || providerBoundaries[0] !== expected) {
582
+ context.addIssue({
583
+ code: 'custom',
584
+ path: ['boundaries', 'providers'],
585
+ message: `a provider module's boundaries are exactly [\`${expected}\`] (found ${JSON.stringify(providerBoundaries)})`,
586
+ });
587
+ }
588
+ const otherLayers = MODULE_BOUNDARY_LAYERS.filter((layer) => layer !== 'providers' && (manifest.boundaries?.[layer] ?? []).length > 0);
589
+ if (otherLayers.length > 0) {
590
+ context.addIssue({
591
+ code: 'custom',
592
+ path: ['boundaries'],
593
+ message: `a provider module writes only below \`providers/\`, but it also declares ${otherLayers.join(', ')}`,
594
+ });
595
+ }
596
+ });
155
597
  //# sourceMappingURL=module-manifest.schemas.js.map