@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.
Files changed (167) 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 +23 -1
  4. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.contracts.js +24 -0
  6. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +70 -1
  8. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  9. package/dist/esm/bootstrap/bootstrap.schemas.js +55 -4
  10. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -0
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  13. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
  14. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  15. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  16. package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
  17. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  18. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  19. package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
  20. package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
  21. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  22. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
  23. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  24. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
  25. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  26. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  27. package/dist/esm/config-authoring.entry.js.map +1 -1
  28. package/dist/esm/index.d.ts +1 -0
  29. package/dist/esm/index.d.ts.map +1 -1
  30. package/dist/esm/index.js +1 -0
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
  33. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
  34. package/dist/esm/lockfile/build-parallelism.js +64 -0
  35. package/dist/esm/lockfile/build-parallelism.js.map +1 -0
  36. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  37. package/dist/esm/lockfile/materialize-infra-section.d.ts +1 -1
  38. package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
  39. package/dist/esm/lockfile/materialize-infra-section.js +1 -1
  40. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  41. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  42. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  43. package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
  44. package/dist/esm/project-config/define-infra-env-config.d.ts +899 -15
  45. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  46. package/dist/esm/project-config/define-infra-env-config.js +397 -16
  47. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  48. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  49. package/dist/esm/project-config/define-minion-config.js +1 -2
  50. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  51. package/dist/esm/project-config/define-saas-config.d.ts +90 -25
  52. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  53. package/dist/esm/project-config/define-saas-config.js +165 -12
  54. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  55. package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
  56. package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
  57. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
  58. package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
  59. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
  60. package/dist/esm/project-config/index.d.ts +3 -0
  61. package/dist/esm/project-config/index.d.ts.map +1 -1
  62. package/dist/esm/project-config/index.js +3 -0
  63. package/dist/esm/project-config/index.js.map +1 -1
  64. package/dist/esm/project-config/loader.d.ts +24 -0
  65. package/dist/esm/project-config/loader.d.ts.map +1 -1
  66. package/dist/esm/project-config/loader.js +114 -1
  67. package/dist/esm/project-config/loader.js.map +1 -1
  68. package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
  69. package/dist/esm/project-config/provider-companion-discovery.d.ts +32 -0
  70. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  71. package/dist/esm/project-config/provider-companion-discovery.js +82 -12
  72. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  73. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +71 -22
  74. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  75. package/dist/esm/project-config/provider-runtime-artifacts.js +135 -13
  76. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  77. package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
  78. package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
  79. package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
  80. package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
  81. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  82. package/dist/esm/project-config/shared/auth.schemas.js +14 -35
  83. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  84. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +17 -12
  85. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  86. package/dist/esm/project-config/shared/backing-services.schemas.js +17 -12
  87. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  88. package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
  89. package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
  90. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  91. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  92. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  93. package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
  94. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  95. package/dist/esm/project-config/shared/csp.schemas.js +11 -12
  96. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  97. package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
  98. package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
  99. package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
  100. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  101. package/dist/esm/project-config/shared/environment.schemas.js +186 -9
  102. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  103. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +5 -6
  104. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  105. package/dist/esm/project-config/shared/infra-providers.schemas.js +0 -3
  106. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  107. package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
  108. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  109. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  110. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  111. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  112. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
  113. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  114. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +77 -47
  115. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  116. package/dist/esm/project-config/shared/minion-resource-access.validation.js +114 -52
  117. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  118. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
  119. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  120. package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
  121. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  122. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
  123. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
  124. package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
  125. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
  126. package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
  127. package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
  128. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
  129. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
  130. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
  131. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
  132. package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
  133. package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
  134. package/dist/esm/registry/companion-api.schemas.d.ts.map +1 -1
  135. package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
  136. package/dist/esm/registry/index.d.ts.map +1 -1
  137. package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
  138. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  139. package/dist/esm/registry/module-manifest.schemas.d.ts +10 -16
  140. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  141. package/dist/esm/registry/module-manifest.schemas.js +14 -20
  142. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  143. package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
  144. package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
  145. package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
  146. package/dist/esm/release/framework-release.constants.js.map +1 -1
  147. package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
  148. package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
  149. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  150. package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
  151. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  152. package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
  153. package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
  154. package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
  155. package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
  156. package/dist/esm/workspace-scope/index.d.ts.map +1 -1
  157. package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
  158. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +4 -3
  159. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  160. package/dist/esm/workspace-scope/workspace-homes.schemas.js +6 -5
  161. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  162. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
  163. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  164. package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
  165. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  166. package/dist/tsconfig.build.tsbuildinfo +1 -1
  167. package/package.json +7 -7
@@ -10,9 +10,9 @@ import { z } from 'zod';
10
10
  * refreshTokenExpirationDays}`. The runtime backend reads them at
11
11
  * token-sign time (`auth-token-issuer.backend.service.ts`,
12
12
  * `jwt.backend.service.ts`).
13
- * - When the operator omits `serviceAuth`, apps-manager applies these
14
- * schema-level defaults (15 min / 30 days) via
15
- * `WildoAuthConfigSchema.parse({})` \u2014 NOT a service-local literal.
13
+ * - First registration uses the schema defaults when `serviceAuth` is absent. Ordinary
14
+ * re-registration preserves the stored policy when the whole block is omitted. A present
15
+ * block resolves omitted members through these defaults and reconciles both lifetimes.
16
16
  *
17
17
  * Default tightening (Auth-hardening Slice A Step 5, 2026-04-13):
18
18
  * - `accessTokenExpirationMinutes` default was lowered from 60 \u2192 15 in
@@ -35,39 +35,18 @@ import { z } from 'zod';
35
35
  * `platform-services-to-manager.apps-manager.platform.controller.ts`).
36
36
  * Authoring an algorithm here would add a knob with no honest consumer.
37
37
  *
38
- * CLI init-path scope (Slice 3.3 closeout, L-4):
39
- * - The CLI forwards this block via `wildo init` /
40
- * `wildo sync --override` for a SINGLE wildo-application at a time
41
- * (`AdminAppInitializeRequestSchema.serviceAuth`). There is no
42
- * batch-init transport surface that fans `serviceAuth` out across
43
- * multiple apps; `AdminAppInitializeTargetSchema.serviceAuth` is
44
- * evaluated per target by the apps-manager init endpoint.
45
- * - The "current" CLI flow always carries `env.serviceAuth` when
46
- * present in `wildo.infra.<env>.config.ts`.
38
+ * Publication lifecycle:
39
+ * - The CLI forwards `env.serviceAuth` through the admin initialization request. Existing
40
+ * applications reconcile an explicitly supplied policy even when no other settings changed;
41
+ * no broad initialization override is required for a token-lifetime-only change.
42
+ * - Ordinary initialization with an omitted block preserves existing lifetimes, including
43
+ * incidental public-key/database repairs. Explicit `override:true` retains its wider reset
44
+ * semantics: absent `serviceAuth` resets lifetimes to the schema defaults below.
45
+ * - Applications retrieve the persisted policy at startup. Running processes do not receive
46
+ * live policy updates, and existing tokens retain the expiration already encoded in them.
47
47
  *
48
- * `override:true` + omitted `serviceAuth` semantics (Slice 3.3.10):
49
- * - The apps-manager production call site invokes
50
- * `_merge_WildoApplicationConfig(currentConfig=null, newConfig={})`,
51
- * which reduces to "return the freshly-built `defaultConfig`". The
52
- * `defaultConfig` is seeded by `_getDefault_WildoApplicationConfig`
53
- * with `WildoAuthConfigSchema.parse(serviceAuth ?? {})`. So when an
54
- * older CLI or a direct HTTP caller omits `serviceAuth` AND passes
55
- * `override:true`, the persisted TTLs are RESET to the schema
56
- * defaults below (60 min / 30 days) \u2014 they are NOT preserved. The
57
- * only path that preserves the persisted TTLs is `override:false`,
58
- * where the upstream guard at
59
- * `wildo-application-lifecycle.apps-manager.platform.service.ts:~869`
60
- * skips the `repository.update` call entirely.
61
- * - Caveat: that upstream guard ALSO triggers `repository.update` on
62
- * `needsPublicKeyUpdate` and `needsDatabaseConfigUpdate` (e.g. JWT
63
- * key rotation, k8s host hydration). When either bypass fires with
64
- * `override:false` AND `serviceAuth` omitted, the persisted TTLs
65
- * silently rebind to the schema defaults too. See the JSDoc on
66
- * `_merge_WildoApplicationConfig` for the full enumeration.
67
- *
68
- * Pinned by `wildo-application-lifecycle.defaults.test.ts` (production
69
- * shape: `(null, {})` + omitted `serviceAuth` returns 15/30 from
70
- * `WildoAuthConfigSchema.parse({})`).
48
+ * Pinned by `managed-token-policy-convergence.apps-manager.platform.test.ts` and the lifecycle
49
+ * default derivation tests; the former exercises persistence and the bootstrap consumer offline.
71
50
  */
72
51
  /**
73
52
  * `z.strictObject` (Zod 4) is intentional: any unknown key (e.g. a
@@ -1 +1 @@
1
- {"version":3,"file":"auth.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/auth.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC;IAClD;;;;;;;;;OASG;IACH,4BAA4B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACrE;;;;;;OAMG;IACH,0BAA0B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACpE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * Authored JWT TTL policy block for `wildo.infra.<env>.config.ts`.\n *\n * Source-of-truth contract (Slice 3.3, F-24):\n * - `accessTokenExpirationMinutes` and `refreshTokenExpirationDays` are\n * threaded by the CLI through the apps-manager init endpoint\n * (`AdminAppInitializeRequest.serviceAuth`) into\n * `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}`. The runtime backend reads them at\n * token-sign time (`auth-token-issuer.backend.service.ts`,\n * `jwt.backend.service.ts`).\n * - When the operator omits `serviceAuth`, apps-manager applies these\n * schema-level defaults (15 min / 30 days) via\n * `WildoAuthConfigSchema.parse({})` \\u2014 NOT a service-local literal.\n *\n * Default tightening (Auth-hardening Slice A Step 5, 2026-04-13):\n * - `accessTokenExpirationMinutes` default was lowered from 60 \\u2192 15 in\n * conjunction with the cookie migration (Slice A Steps 2 + 3). With the\n * refresh token now confined to an `HttpOnly` cookie, an XSS bug only\n * exposes the SHORT-lived access token; the smaller the access-token\n * window, the smaller the residual XSS-stolen-token blast radius.\n * Operator overrides via `serviceAuth.accessTokenExpirationMinutes` in\n * `wildo.infra.<env>.config.ts` are untouched \\u2014 author a value to\n * deviate from the framework recommendation. The refresh-token TTL\n * (`refreshTokenExpirationDays`) is unchanged at 30 days because the\n * cookie-confined refresh token does not benefit from an additional\n * TTL squeeze (rotation + JTI blacklist + reuse detection already bound\n * the steal window per use).\n *\n * Algorithm selection is intentionally NOT authored here: the application\n * JWT signing path (`jwt.backend.service.ts`) selects per the per-service\n * key convention, and the apps-manager response-signer pins ES256 for the\n * config-handshake envelope (anti-replay, see F-55 JSDoc on\n * `platform-services-to-manager.apps-manager.platform.controller.ts`).\n * Authoring an algorithm here would add a knob with no honest consumer.\n *\n * CLI init-path scope (Slice 3.3 closeout, L-4):\n * - The CLI forwards this block via `wildo init` /\n * `wildo sync --override` for a SINGLE wildo-application at a time\n * (`AdminAppInitializeRequestSchema.serviceAuth`). There is no\n * batch-init transport surface that fans `serviceAuth` out across\n * multiple apps; `AdminAppInitializeTargetSchema.serviceAuth` is\n * evaluated per target by the apps-manager init endpoint.\n * - The \"current\" CLI flow always carries `env.serviceAuth` when\n * present in `wildo.infra.<env>.config.ts`.\n *\n * `override:true` + omitted `serviceAuth` semantics (Slice 3.3.10):\n * - The apps-manager production call site invokes\n * `_merge_WildoApplicationConfig(currentConfig=null, newConfig={})`,\n * which reduces to \"return the freshly-built `defaultConfig`\". The\n * `defaultConfig` is seeded by `_getDefault_WildoApplicationConfig`\n * with `WildoAuthConfigSchema.parse(serviceAuth ?? {})`. So when an\n * older CLI or a direct HTTP caller omits `serviceAuth` AND passes\n * `override:true`, the persisted TTLs are RESET to the schema\n * defaults below (60 min / 30 days) \\u2014 they are NOT preserved. The\n * only path that preserves the persisted TTLs is `override:false`,\n * where the upstream guard at\n * `wildo-application-lifecycle.apps-manager.platform.service.ts:~869`\n * skips the `repository.update` call entirely.\n * - Caveat: that upstream guard ALSO triggers `repository.update` on\n * `needsPublicKeyUpdate` and `needsDatabaseConfigUpdate` (e.g. JWT\n * key rotation, k8s host hydration). When either bypass fires with\n * `override:false` AND `serviceAuth` omitted, the persisted TTLs\n * silently rebind to the schema defaults too. See the JSDoc on\n * `_merge_WildoApplicationConfig` for the full enumeration.\n *\n * Pinned by `wildo-application-lifecycle.defaults.test.ts` (production\n * shape: `(null, {})` + omitted `serviceAuth` returns 15/30 from\n * `WildoAuthConfigSchema.parse({})`).\n */\n/**\n * `z.strictObject` (Zod 4) is intentional: any unknown key (e.g. a\n * re-introduced `jwtAlgorithm`, or a typo'd `accessTokenExpirationMinute`)\n * must surface as a parse error instead of being silently stripped. This\n * is the framework-mindset enforcement of the \"no honest consumer => no\n * authored knob\" rule documented in the file-level JSDoc above.\n */\nexport const WildoAuthConfigSchema = z.strictObject({\n /**\n * Access-token TTL in minutes. Authored value > schema default (15).\n * Threaded into `Wildo_Application_Config.jwt.accessTokenExpiration\n * Minutes` at apps-manager init time; consumed at token-sign time by\n * `AuthTokenIssuerBackendService.issueAccessToken`.\n *\n * Default = 15 (Auth-hardening Slice A Step 5, 2026-04-13). Pre-Slice-A\n * the default was 60 \\u2014 the file-level JSDoc above documents the\n * threat-model rationale for the tightening.\n */\n accessTokenExpirationMinutes: z.number().int().positive().default(15),\n /**\n * Refresh-token TTL in days. Authored value > schema default (30).\n * Threaded into `Wildo_Application_Config.jwt.refreshTokenExpiration\n * Days` at apps-manager init time; consumed at token-sign time by\n * `JwtBackendService.createRefreshToken` and at session-bookkeeping\n * time by `AuthTokenIssuerBackendService.invalidateAllTokensForUser`.\n */\n refreshTokenExpirationDays: z.number().int().positive().default(30),\n});\nexport type WildoAuthConfig = z.infer<typeof WildoAuthConfigSchema>;\nexport type WildoAuthConfigInput = z.input<typeof WildoAuthConfigSchema>;\n"]}
1
+ {"version":3,"file":"auth.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/auth.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC;IAClD;;;;;;;;;OASG;IACH,4BAA4B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACrE;;;;;;OAMG;IACH,0BAA0B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACpE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * Authored JWT TTL policy block for `wildo.infra.<env>.config.ts`.\n *\n * Source-of-truth contract (Slice 3.3, F-24):\n * - `accessTokenExpirationMinutes` and `refreshTokenExpirationDays` are\n * threaded by the CLI through the apps-manager init endpoint\n * (`AdminAppInitializeRequest.serviceAuth`) into\n * `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}`. The runtime backend reads them at\n * token-sign time (`auth-token-issuer.backend.service.ts`,\n * `jwt.backend.service.ts`).\n * - First registration uses the schema defaults when `serviceAuth` is absent. Ordinary\n * re-registration preserves the stored policy when the whole block is omitted. A present\n * block resolves omitted members through these defaults and reconciles both lifetimes.\n *\n * Default tightening (Auth-hardening Slice A Step 5, 2026-04-13):\n * - `accessTokenExpirationMinutes` default was lowered from 60 \\u2192 15 in\n * conjunction with the cookie migration (Slice A Steps 2 + 3). With the\n * refresh token now confined to an `HttpOnly` cookie, an XSS bug only\n * exposes the SHORT-lived access token; the smaller the access-token\n * window, the smaller the residual XSS-stolen-token blast radius.\n * Operator overrides via `serviceAuth.accessTokenExpirationMinutes` in\n * `wildo.infra.<env>.config.ts` are untouched \\u2014 author a value to\n * deviate from the framework recommendation. The refresh-token TTL\n * (`refreshTokenExpirationDays`) is unchanged at 30 days because the\n * cookie-confined refresh token does not benefit from an additional\n * TTL squeeze (rotation + JTI blacklist + reuse detection already bound\n * the steal window per use).\n *\n * Algorithm selection is intentionally NOT authored here: the application\n * JWT signing path (`jwt.backend.service.ts`) selects per the per-service\n * key convention, and the apps-manager response-signer pins ES256 for the\n * config-handshake envelope (anti-replay, see F-55 JSDoc on\n * `platform-services-to-manager.apps-manager.platform.controller.ts`).\n * Authoring an algorithm here would add a knob with no honest consumer.\n *\n * Publication lifecycle:\n * - The CLI forwards `env.serviceAuth` through the admin initialization request. Existing\n * applications reconcile an explicitly supplied policy even when no other settings changed;\n * no broad initialization override is required for a token-lifetime-only change.\n * - Ordinary initialization with an omitted block preserves existing lifetimes, including\n * incidental public-key/database repairs. Explicit `override:true` retains its wider reset\n * semantics: absent `serviceAuth` resets lifetimes to the schema defaults below.\n * - Applications retrieve the persisted policy at startup. Running processes do not receive\n * live policy updates, and existing tokens retain the expiration already encoded in them.\n *\n * Pinned by `managed-token-policy-convergence.apps-manager.platform.test.ts` and the lifecycle\n * default derivation tests; the former exercises persistence and the bootstrap consumer offline.\n */\n/**\n * `z.strictObject` (Zod 4) is intentional: any unknown key (e.g. a\n * re-introduced `jwtAlgorithm`, or a typo'd `accessTokenExpirationMinute`)\n * must surface as a parse error instead of being silently stripped. This\n * is the framework-mindset enforcement of the \"no honest consumer => no\n * authored knob\" rule documented in the file-level JSDoc above.\n */\nexport const WildoAuthConfigSchema = z.strictObject({\n /**\n * Access-token TTL in minutes. Authored value > schema default (15).\n * Threaded into `Wildo_Application_Config.jwt.accessTokenExpiration\n * Minutes` at apps-manager init time; consumed at token-sign time by\n * `AuthTokenIssuerBackendService.issueAccessToken`.\n *\n * Default = 15 (Auth-hardening Slice A Step 5, 2026-04-13). Pre-Slice-A\n * the default was 60 \\u2014 the file-level JSDoc above documents the\n * threat-model rationale for the tightening.\n */\n accessTokenExpirationMinutes: z.number().int().positive().default(15),\n /**\n * Refresh-token TTL in days. Authored value > schema default (30).\n * Threaded into `Wildo_Application_Config.jwt.refreshTokenExpiration\n * Days` at apps-manager init time; consumed at token-sign time by\n * `JwtBackendService.createRefreshToken` and at session-bookkeeping\n * time by `AuthTokenIssuerBackendService.invalidateAllTokensForUser`.\n */\n refreshTokenExpirationDays: z.number().int().positive().default(30),\n});\nexport type WildoAuthConfig = z.infer<typeof WildoAuthConfigSchema>;\nexport type WildoAuthConfigInput = z.input<typeof WildoAuthConfigSchema>;\n"]}
@@ -291,19 +291,20 @@ export declare const BackingServiceKindToInfraCapability: Record<BackingServiceK
291
291
  * | `POSTGRESQL` | `MANAGED` | `'supabase'` | `POSTGRES_SUPABASE` |
292
292
  * | `POSTGRESQL` | `MANAGED` | `'neon'` | `POSTGRES_NEON` |
293
293
  * | `POSTGRESQL` | `MANAGED` | `'render'` | `POSTGRES_RENDER` |
294
- * | `POSTGRESQL` | `MANAGED` | (unset) | `POSTGRES_MANAGED` (generic fallback) |
294
+ * | `POSTGRESQL` | `MANAGED` | unset or unrecognized | `POSTGRES_MANAGED` (generic fallback) |
295
295
  * | `REDIS` | `SELF` | (any) | `REDIS_SELF` |
296
296
  * | `RABBITMQ` | `SELF` | (any) | `RABBITMQ_SELF` |
297
- * | `S3` | `SELF` | (`'minio'` or unset) | `MINIO_SELF` |
298
- * | `S3` | `MANAGED` | `'aws'` | `AWS_S3` |
297
+ * | `S3` | (either) | `'minio'` | `MINIO_SELF` |
298
+ * | `S3` | (either) | `'aws'` | `AWS_S3` |
299
+ * | `S3` | `SELF` | unset or unrecognized | `MINIO_SELF` |
300
+ * | `S3` | `MANAGED` | unset or unrecognized | `AWS_S3` |
299
301
  * | `CLAMAV` | `SELF` | (any) | `CLAMAV_SELF` |
300
302
  * | `IMMUDB` | `SELF` | (any) | `IMMUDB_SELF` |
301
303
  *
302
304
  * Returns `undefined` for combinations not in the table — for kinds
303
- * whose `InfraProvider` catalog has no concrete entry yet (METRICS,
304
- * BACKUP) and for unrecognized brand strings on managed
305
- * Mongo / S3 (they don't have a generic `<KIND>_MANAGED` fallback,
306
- * unlike Postgres). Callers decide whether `undefined` is fail-closed
305
+ * whose `InfraProvider` catalog has no concrete entry yet (BACKUP)
306
+ * and for unrecognized managed Mongo brands. PostgreSQL has a generic
307
+ * managed fallback; S3 uses brand-first resolution, then source-based defaults. Callers decide whether `undefined` is fail-closed
307
308
  * (planner running with unknown infra catalog) or accepted (lockfile
308
309
  * pre-declaration).
309
310
  *
@@ -322,12 +323,16 @@ export declare const BackingServiceKindToInfraCapability: Record<BackingServiceK
322
323
  * lockfile's infra section to see which of your declarations were actually resolved.
323
324
  *
324
325
  * **An unrecognised brand is not the same failure on every kind.** On the relational database it
325
- * falls back to the generic managed entry, so a typo still resolves. On the document database and on
326
- * object storage there is no generic fallback, so a typo resolves to nothing and is skipped.
326
+ * falls back to the generic managed entry, so a typo still resolves. On the document database,
327
+ * an unknown managed brand resolves to nothing. Object storage recognizes minio/aws first, then
328
+ * falls back by source: SELF to MinIO, MANAGED to AWS S3, including unrecognized brands.
327
329
  *
328
- * **Declaring a service managed does not always stop the local one being rendered.** The inclusion
329
- * gates in the Compose and Kubernetes lanes are separate from this resolution and cover different
330
- * kinds, so a managed declaration can leave a local container in the rendered stack beside it.
330
+ * **Provider resolution and workload inclusion answer different questions.** Compose and Kubernetes
331
+ * both use the same per-kind inclusion policy, separately from catalogue resolution. Cache, broker
332
+ * and S3 default to self-hosted unless explicitly MANAGED; ClamAV and immudb require explicit SELF.
333
+ * MongoDB and PostgreSQL also include the platform database requirement: an application-level
334
+ * managed choice does not remove a self-hosted database still needed by the platform. Backup has
335
+ * no rendered workload. Do not infer workload inclusion from this provider resolver.
331
336
  */
332
337
  export declare function resolveInfraProvider(kind: BackingServiceKind, source: BackingServiceSource, provider?: string): InfraProvider | undefined;
333
338
  /** @wildo_source:part:end platform.config.infra-provider-resolution */
@@ -1 +1 @@
1
- {"version":3,"file":"backing-services.schemas.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/backing-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,EAAE,OAAO;IACT,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB;;;;OAIG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oBAAY,oBAAoB;IAC9B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AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,gBAAgB,GAChB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAShC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,8DAA8D;AAe9D,2HAA2H;AAC3H;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,EAAE,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAS3F,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,GAAG,SAAS,CAsE3B;AACD,uEAAuE"}
1
+ {"version":3,"file":"backing-services.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/backing-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,EAAE,OAAO;IACT,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB;;;;OAIG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oBAAY,oBAAoB;IAC9B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AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,gBAAgB,GAChB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAShC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,8DAA8D;AAe9D,2HAA2H;AAC3H;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,EAAE,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAS3F,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,GAAG,SAAS,CAsE3B;AACD,uEAAuE"}
@@ -268,19 +268,20 @@ export const BackingServiceKindToInfraCapability = {
268
268
  * | `POSTGRESQL` | `MANAGED` | `'supabase'` | `POSTGRES_SUPABASE` |
269
269
  * | `POSTGRESQL` | `MANAGED` | `'neon'` | `POSTGRES_NEON` |
270
270
  * | `POSTGRESQL` | `MANAGED` | `'render'` | `POSTGRES_RENDER` |
271
- * | `POSTGRESQL` | `MANAGED` | (unset) | `POSTGRES_MANAGED` (generic fallback) |
271
+ * | `POSTGRESQL` | `MANAGED` | unset or unrecognized | `POSTGRES_MANAGED` (generic fallback) |
272
272
  * | `REDIS` | `SELF` | (any) | `REDIS_SELF` |
273
273
  * | `RABBITMQ` | `SELF` | (any) | `RABBITMQ_SELF` |
274
- * | `S3` | `SELF` | (`'minio'` or unset) | `MINIO_SELF` |
275
- * | `S3` | `MANAGED` | `'aws'` | `AWS_S3` |
274
+ * | `S3` | (either) | `'minio'` | `MINIO_SELF` |
275
+ * | `S3` | (either) | `'aws'` | `AWS_S3` |
276
+ * | `S3` | `SELF` | unset or unrecognized | `MINIO_SELF` |
277
+ * | `S3` | `MANAGED` | unset or unrecognized | `AWS_S3` |
276
278
  * | `CLAMAV` | `SELF` | (any) | `CLAMAV_SELF` |
277
279
  * | `IMMUDB` | `SELF` | (any) | `IMMUDB_SELF` |
278
280
  *
279
281
  * Returns `undefined` for combinations not in the table — for kinds
280
- * whose `InfraProvider` catalog has no concrete entry yet (METRICS,
281
- * BACKUP) and for unrecognized brand strings on managed
282
- * Mongo / S3 (they don't have a generic `<KIND>_MANAGED` fallback,
283
- * unlike Postgres). Callers decide whether `undefined` is fail-closed
282
+ * whose `InfraProvider` catalog has no concrete entry yet (BACKUP)
283
+ * and for unrecognized managed Mongo brands. PostgreSQL has a generic
284
+ * managed fallback; S3 uses brand-first resolution, then source-based defaults. Callers decide whether `undefined` is fail-closed
284
285
  * (planner running with unknown infra catalog) or accepted (lockfile
285
286
  * pre-declaration).
286
287
  *
@@ -299,12 +300,16 @@ export const BackingServiceKindToInfraCapability = {
299
300
  * lockfile's infra section to see which of your declarations were actually resolved.
300
301
  *
301
302
  * **An unrecognised brand is not the same failure on every kind.** On the relational database it
302
- * falls back to the generic managed entry, so a typo still resolves. On the document database and on
303
- * object storage there is no generic fallback, so a typo resolves to nothing and is skipped.
303
+ * falls back to the generic managed entry, so a typo still resolves. On the document database,
304
+ * an unknown managed brand resolves to nothing. Object storage recognizes minio/aws first, then
305
+ * falls back by source: SELF to MinIO, MANAGED to AWS S3, including unrecognized brands.
304
306
  *
305
- * **Declaring a service managed does not always stop the local one being rendered.** The inclusion
306
- * gates in the Compose and Kubernetes lanes are separate from this resolution and cover different
307
- * kinds, so a managed declaration can leave a local container in the rendered stack beside it.
307
+ * **Provider resolution and workload inclusion answer different questions.** Compose and Kubernetes
308
+ * both use the same per-kind inclusion policy, separately from catalogue resolution. Cache, broker
309
+ * and S3 default to self-hosted unless explicitly MANAGED; ClamAV and immudb require explicit SELF.
310
+ * MongoDB and PostgreSQL also include the platform database requirement: an application-level
311
+ * managed choice does not remove a self-hosted database still needed by the platform. Backup has
312
+ * no rendered workload. Do not infer workload inclusion from this provider resolver.
308
313
  */
309
314
  export function resolveInfraProvider(kind, source, provider) {
310
315
  switch (kind) {
@@ -1 +1 @@
1
- {"version":3,"file":"backing-services.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/backing-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAN,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,2CAAqB,CAAA;IACrB,+BAAS,CAAA;IACT,+CAAyB,CAAA;IACzB,uCAAiB,CAAA;IACjB;;;;OAIG;IACH,uCAAiB,CAAA;IACjB;;OAEG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAjBW,kBAAkB,KAAlB,kBAAkB,QAiB7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,2CAAmB,CAAA;AACrB,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC;IACpC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,E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O,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,EAAE;YACxB,qDAAqD;YACrD,8DAA8D;YAC9D,8DAA8D;YAC9D,8DAA8D;YAC9D,+BAA+B;YAC/B,IAAI,QAAQ,KAAK,OAAO;gBAAE,OAAO,aAAa,CAAC,UAAU,CAAC;YAC1D,IAAI,QAAQ,KAAK,KAAK;gBAAE,OAAO,aAAa,CAAC,MAAM,CAAC;YACpD,2DAA2D;YAC3D,2DAA2D;YAC3D,IAAI,MAAM,KAAK,oBAAoB,CAAC,IAAI;gBAAE,OAAO,aAAa,CAAC,UAAU,CAAC;YAC1E,IAAI,MAAM,KAAK,oBAAoB,CAAC,OAAO;gBAAE,OAAO,aAAa,CAAC,MAAM,CAAC;YACzE,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,MAAM;YAC5B,IAAI,MAAM,KAAK,oBAAoB,CAAC,IAAI;gBAAE,OAAO,aAAa,CAAC,WAAW,CAAC;YAC3E,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,MAAM;YAC5B,IAAI,MAAM,KAAK,oBAAoB,CAAC,IAAI;gBAAE,OAAO,aAAa,CAAC,WAAW,CAAC;YAC3E,wEAAwE;YACxE,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,MAAM;YAC5B,4FAA4F;YAC5F,oFAAoF;YACpF,EAAE;YACF,2FAA2F;YAC3F,0EAA0E;YAC1E,wFAAwF;YACxF,uEAAuE;YACvE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AACD,uEAAuE","sourcesContent":["import { z } from 'zod';\nimport {\n InfraCapability,\n InfraProvider,\n} from './infra-providers.schemas';\n\n/**\n * The backing-service authoring surface of `wildo.infra.<env>.config.ts`.\n *\n * Import from `@wildo-ai/platform-config-lib`. Everything below is what an\n * environment file may declare under `backingServices: { ... }` — the closed kind\n * vocabulary, the hosting-model axis, and the per-kind entry shape. The\n * `InfraCapability` / `InfraProvider` projections further down this file are\n * planner-internal and deliberately outside the anchor: an app author never writes\n * them.\n *\n * Declare a kind ONLY when the environment actually runs it — keys are optional so a\n * flattened app declaration stays truthful about what it enables. Omitting a kind an\n * enabled engine capability depends on is the classic silent-degradation bug: e.g.\n * `COMPLIANCE_AUDIT_TRAIL` without `immudb` leaves the tamper-evident audit store\n * unbacked, which `wildo config sync` reports as a warning per environment.\n *\n * @wildo_source:part:start platform.config.backing-services facet:layer:platform facet:family:infra\n */\nexport enum BackingServiceKind {\n MONGODB = 'mongodb',\n REDIS = 'redis',\n RABBITMQ = 'rabbitmq',\n S3 = 's3',\n POSTGRESQL = 'postgresql',\n CLAMAV = 'clamav',\n /**\n * immudb — an immutable, cryptographically-verifiable database used as a\n * tamper-evident audit-log store (fills the `AUDIT_LOG_STORAGE` capability).\n * A stateful DB: a data volume in dev, self-hosted or immudb Vault in prod.\n */\n IMMUDB = 'immudb',\n /**\n * Backup orchestration target. Stateless base for now.\n */\n BACKUP = 'backup',\n}\n\n/**\n * Hosting model of a backing service instance — the orthogonal axis to\n * the **brand** (which is captured by the per-kind `provider` field).\n *\n * - `self`: self-hosted (Docker/K8s container managed by the platform,\n * or operator-managed on-prem). Brands here are open-source\n * software names (e.g. MinIO for S3, vanilla Postgres / MongoDB).\n * - `managed`: external vendor-managed service. Brands here are\n * vendor names (e.g. `'atlas'` for MongoDB Atlas, `'aws-rds'` for\n * AWS RDS, `'supabase'` for Supabase Postgres, `'aws'` for AWS S3).\n *\n * **Slice 4.B.0 reshape (2026-05-07)**: the `ATLAS` value was removed.\n * Pre-reshape `source: ATLAS` becomes `source: MANAGED, provider:\n * 'atlas'`. The reshape generalizes from \"Mongo + S3 are the only\n * brand-aware kinds\" to \"every kind can be brand-aware when the\n * managed market has multiple vendors\" — Postgres in particular\n * (RDS / GCP Cloud SQL / Supabase / Neon / Render / Azure).\n */\nexport enum BackingServiceSource {\n SELF = 'self',\n MANAGED = 'managed',\n}\n\n/**\n * Common fields every backing-service entry shares.\n *\n * Per-kind extensions add the fields that are SEMANTICALLY meaningful\n * for that kind only. Slice 3 closeout (M-4 + L-5): the previous shared\n * `BackingServiceEnvConfigSchema` collapsed `database` into a\n * `union(int, string)` and put `name` only on Mongo; both compromised\n * the framework-mindset rule that \"every field must carry its semantic\n * weight\". The split below means a typo like `redis: { database:\n * 'staging' }` (string on a kind that needs an integer DB index) is\n * rejected at parse time instead of crashing the runtime client at\n * connect time.\n */\nconst BackingServiceBaseSchema = z.object({\n source: z.enum(BackingServiceSource),\n /**\n * Brand of the backing service. Orthogonal to `source` (hosting\n * model). Required-in-spirit when `source === MANAGED` and the\n * managed market has multiple vendors (Mongo: `'atlas'` /\n * `'aws-documentdb'` / …; Postgres: `'aws-rds'` / `'gcp-cloud-sql'`\n * / `'supabase'` / `'neon'` / `'render'` / `'azure-database'`;\n * S3: `'aws'` / `'cloudflare-r2'` / …); optional when `source ===\n * SELF` (e.g. S3-self-hosted defaults to MinIO; `provider:\n * 'minio'` is allowed but redundant).\n *\n * Modeled as `z.string().optional()` rather than per-kind enum\n * unions to keep this base schema simple — the canonical brand\n * vocabulary lives in `resolveInfraProvider`'s dispatch table\n * (each kind documents which brand strings it recognizes; unknown\n * brands fall back to the kind's generic `<KIND>_MANAGED` /\n * `<KIND>_SELF` entry where one exists, otherwise return\n * `undefined`).\n *\n * Slice 4.B.0 (2026-05-07) generalized this from \"S3-only\" to\n * every brand-aware kind.\n */\n provider: z.string().min(1).optional(),\n /**\n * Override the catalog-derived hostname for this kind. Honored at\n * `HOST_FACING` perspective (always) and at `CONTAINER_INTERNAL` for\n * `MANAGED` sources. SELF + `CONTAINER_INTERNAL` keeps the catalog\n * container name because that is the only DNS the container network\n * can resolve.\n */\n host: z.string().min(1).optional(),\n /**\n * Override the catalog-derived listen port. Threaded into both\n * docker-compose `<authored>:<authored>` publish and the per-app\n * env-vars (`<KIND>_PORT`).\n */\n port: z.number().int().positive().optional(),\n}).strict();\n\n/**\n * MongoDB backing service. `database` is the database NAME (string).\n *\n * Mongo's connection URL has the shape `mongodb://host:port/<database>`\n * — this string corresponds to the path segment. Pre-3 the field was\n * `name`; renamed to `database` in Slice 3 closeout (L-5) so all\n * data-store kinds use the same property name for the same concept\n * (vs. Postgres which already used `database`).\n */\nexport const MongoBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type MongoBackingService = z.infer<typeof MongoBackingServiceSchema>;\n\n/**\n * Redis backing service. `database` is the LOGICAL DB INDEX (integer).\n *\n * Redis exposes 16 logical databases (0–15) on a single connection.\n * Authoring a string here (e.g. `'staging'`) would silently parse on\n * the pre-3 union schema and crash ioredis at connect; the integer\n * constraint with `max(15)` fails loud at parse time.\n */\nexport const RedisBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.number().int().min(0).max(15).optional(),\n}).strict();\nexport type RedisBackingService = z.infer<typeof RedisBackingServiceSchema>;\n\n/**\n * PostgreSQL backing service. `database` is the database NAME (string).\n *\n * Symmetric with `MongoBackingService.database` — both are the\n * database identifier in their respective connection URLs.\n */\nexport const PostgresBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type PostgresBackingService = z.infer<typeof PostgresBackingServiceSchema>;\n\n/**\n * RabbitMQ backing service. `vhost` is the RabbitMQ virtual host.\n *\n * AMQP virtual hosts isolate exchange/queue namespaces inside a single\n * broker. NOT a database — RabbitMQ has no DB concept — so the field\n * is intentionally NOT named `database`.\n */\nexport const RabbitBackingServiceSchema = BackingServiceBaseSchema.extend({\n vhost: z.string().min(1).optional(),\n}).strict();\nexport type RabbitBackingService = z.infer<typeof RabbitBackingServiceSchema>;\n\n/**\n * S3-compatible backing service (MinIO, Scaleway Object Storage, AWS).\n *\n * `endpoint` is a URL (`http://localhost:9000`, `https://s3.eu-west.amazonaws.com`)\n * — the resolver parses it into host/port. `bucket` is the S3 bucket\n * name. NOT a database — S3 has no DB concept.\n */\nexport const S3BackingServiceSchema = BackingServiceBaseSchema.extend({\n endpoint: z.string().min(1).optional(),\n bucket: z.string().min(1).optional(),\n}).strict();\nexport type S3BackingService = z.infer<typeof S3BackingServiceSchema>;\n\n/** ClamAV anti-virus daemon. Stateless, no database/vhost/bucket. */\nexport const ClamAvBackingServiceSchema = BackingServiceBaseSchema;\nexport type ClamAvBackingService = z.infer<typeof ClamAvBackingServiceSchema>;\n\n/**\n * immudb backing service (tamper-evident audit-log store). A stateful DB —\n * `database` names the immudb database (defaults to `defaultdb` at runtime);\n * credentials come from the secrets pipeline like every other backing service.\n *\n * Declare this in EVERY environment where the `COMPLIANCE_AUDIT_TRAIL` engine\n * capability is enabled. `wildo config sync` warns per environment when the audit\n * capability is on but no environment declares an audit store, and the audit client\n * then has nowhere tamper-evident to write.\n *\n * You do NOT author the state-signing keypair that makes the store's\n * whole-server-substitution defense work. The framework provisions it (private half\n * mounted into a `source: SELF` immudb via `--signingKey`, public half pinned by the\n * audit client as `IMMUDB_STATE_PUBLIC_KEY`) — declaring the service is the whole job.\n *\n * @example\n * ```ts\n * backingServices: {\n * immudb: { source: BackingServiceSource.SELF },\n * }\n * ```\n */\nexport const ImmudbBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type ImmudbBackingService = z.infer<typeof ImmudbBackingServiceSchema>;\n\n/**\n * Backup orchestration target. Stateless base for now.\n */\nexport const BackupBackingServiceSchema = BackingServiceBaseSchema;\nexport type BackupBackingService = z.infer<typeof BackupBackingServiceSchema>;\n\n/**\n * Discriminated UNION over all backing-service kinds. Used by the\n * `ServiceAddressResolver` and helpers that accept any kind and read\n * only base fields (`source`, `host`, `port`). Consumers that need\n * kind-specific fields MUST narrow first (e.g. via the per-kind type\n * exports above).\n */\nexport type BackingServiceEnvConfig =\n | MongoBackingService\n | RedisBackingService\n | PostgresBackingService\n | RabbitBackingService\n | S3BackingService\n | ClamAvBackingService\n | ImmudbBackingService\n | BackupBackingService;\n\n/**\n * Per-environment backing services config (source for each service).\n * Used in environment-specific infra descriptors.\n *\n * Keys stay optional because an app-owned environment only needs to declare the\n * backing services it actually enables. Requiring the full enum-keyed record\n * would force disabled services (for example `postgresql`) into every env file\n * and breaks truthful flattened targeted-app declarations.\n */\nexport const BackingServicesEnvConfigSchema = z.object({\n [BackingServiceKind.MONGODB]: MongoBackingServiceSchema.optional(),\n [BackingServiceKind.REDIS]: RedisBackingServiceSchema.optional(),\n [BackingServiceKind.RABBITMQ]: RabbitBackingServiceSchema.optional(),\n [BackingServiceKind.S3]: S3BackingServiceSchema.optional(),\n [BackingServiceKind.POSTGRESQL]: PostgresBackingServiceSchema.optional(),\n [BackingServiceKind.CLAMAV]: ClamAvBackingServiceSchema.optional(),\n [BackingServiceKind.IMMUDB]: ImmudbBackingServiceSchema.optional(),\n [BackingServiceKind.BACKUP]: BackupBackingServiceSchema.optional(),\n}).strict();\nexport type BackingServicesEnvConfig = z.infer<typeof BackingServicesEnvConfigSchema>;\n/** @wildo_source:part:end platform.config.backing-services */\n\n// =============================================================================\n// BackingServiceKind ↔ InfraCapability / InfraProvider projections\n// =============================================================================\n//\n// Per `infra-provider-planner.md` R-B (locked 2026-05-06): `BackingServicesEnvConfig`\n// IS the canonical per-env infra-selection authoring surface. The\n// `InfraCapability` / `InfraProvider` enums are the planner's projection\n// vocabulary (used by `InfraProviderModule.supportedCapabilities`,\n// `wildo-saas.lock.json sections.infra` keying, and any tooling that\n// walks \"what infra is selected per env\"). The mappings below are the\n// single source of truth for that projection — no other code may\n// reconstruct them locally.\n\n/** @wildo_source:part:start platform.config.infra-provider-resolution facet:layer:platform facet:audience:app-developer */\n/**\n * `BackingServiceKind` → `InfraCapability`. Every extension to `BackingServiceKind` MUST extend this\n * map in the same commit, otherwise the planner cannot project the new kind to its capability slot.\n *\n * INJECTIVE, not bijective — and the difference is a real property of the model rather than a gap.\n * A capability may be granted to a runtime without any environment declaring a backing service for\n * it; see {@link RUNTIME_GRANTED_INFRA_CAPABILITIES} for the ones that are, and why.\n */\nexport const BackingServiceKindToInfraCapability: Record<BackingServiceKind, InfraCapability> = {\n [BackingServiceKind.MONGODB]: InfraCapability.DOCUMENT_DATABASE,\n [BackingServiceKind.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,\n [BackingServiceKind.RABBITMQ]: InfraCapability.QUEUING_SYSTEM,\n [BackingServiceKind.REDIS]: InfraCapability.CACHE_MANAGER,\n [BackingServiceKind.S3]: InfraCapability.OBJECT_STORAGE,\n [BackingServiceKind.CLAMAV]: InfraCapability.ANTIVIRUS_SCANNING,\n [BackingServiceKind.IMMUDB]: InfraCapability.AUDIT_LOG_STORAGE,\n [BackingServiceKind.BACKUP]: InfraCapability.BACKUP_MANAGER,\n};\n\n/**\n * Project `(BackingServiceKind, source, provider?)` → `InfraProvider`.\n *\n * The three-axis dispatch (kind × hosting-model × brand) generalizes\n * the source/brand split across all kinds (Slice 4.B.0, 2026-05-07\n * — was source-only with Atlas as a special source value before).\n *\n * **Brand vocabulary** per kind (`provider` field on the authored\n * `BackingService<X>Schema`):\n *\n * | Kind | source | provider | InfraProvider |\n * |---|---|---|---|\n * | `MONGODB` | `SELF` | (any) | `MONGODB_SELF` |\n * | `MONGODB` | `MANAGED` | `'atlas'` | `MONGODB_ATLAS` |\n * | `POSTGRESQL` | `SELF` | (any) | `POSTGRES_SELF` |\n * | `POSTGRESQL` | `MANAGED` | `'aws-rds'` | `POSTGRES_AWS_RDS` |\n * | `POSTGRESQL` | `MANAGED` | `'gcp-cloud-sql'` | `POSTGRES_GCP_CLOUD_SQL` |\n * | `POSTGRESQL` | `MANAGED` | `'azure-database'` | `POSTGRES_AZURE_DATABASE` |\n * | `POSTGRESQL` | `MANAGED` | `'supabase'` | `POSTGRES_SUPABASE` |\n * | `POSTGRESQL` | `MANAGED` | `'neon'` | `POSTGRES_NEON` |\n * | `POSTGRESQL` | `MANAGED` | `'render'` | `POSTGRES_RENDER` |\n * | `POSTGRESQL` | `MANAGED` | (unset) | `POSTGRES_MANAGED` (generic fallback) |\n * | `REDIS` | `SELF` | (any) | `REDIS_SELF` |\n * | `RABBITMQ` | `SELF` | (any) | `RABBITMQ_SELF` |\n * | `S3` | `SELF` | (`'minio'` or unset) | `MINIO_SELF` |\n * | `S3` | `MANAGED` | `'aws'` | `AWS_S3` |\n * | `CLAMAV` | `SELF` | (any) | `CLAMAV_SELF` |\n * | `IMMUDB` | `SELF` | (any) | `IMMUDB_SELF` |\n *\n * Returns `undefined` for combinations not in the table — for kinds\n * whose `InfraProvider` catalog has no concrete entry yet (METRICS,\n * BACKUP) and for unrecognized brand strings on managed\n * Mongo / S3 (they don't have a generic `<KIND>_MANAGED` fallback,\n * unlike Postgres). Callers decide whether `undefined` is fail-closed\n * (planner running with unknown infra catalog) or accepted (lockfile\n * pre-declaration).\n *\n * ## What this means when you author an environment\n *\n * **`MANAGED` does not reach every kind.** The table above is the whole of it: a managed vendor\n * resolves for the relational database (six named brands plus a generic fallback), the document\n * database (`'atlas'` only) and object storage. Declaring `{ source: MANAGED }` on the cache, the\n * broker, the antivirus scanner, the audit store or the backup target resolves to NOTHING — those\n * kinds are self-hosted only until their vendor catalogue is built.\n *\n * **And nothing tells you.** A kind that resolves to no provider is SKIPPED when the lockfile's infra\n * section is materialised, silently, because recording an entry with no provider would lie. So a\n * managed declaration the catalogue cannot serve looks exactly like a correct one: `wildo config\n * sync` succeeds, the file says `MANAGED`, and the environment has no managed anything. Read the\n * lockfile's infra section to see which of your declarations were actually resolved.\n *\n * **An unrecognised brand is not the same failure on every kind.** On the relational database it\n * falls back to the generic managed entry, so a typo still resolves. On the document database and on\n * object storage there is no generic fallback, so a typo resolves to nothing and is skipped.\n *\n * **Declaring a service managed does not always stop the local one being rendered.** The inclusion\n * gates in the Compose and Kubernetes lanes are separate from this resolution and cover different\n * kinds, so a managed declaration can leave a local container in the rendered stack beside it.\n */\nexport function resolveInfraProvider(\n kind: BackingServiceKind,\n source: BackingServiceSource,\n provider?: string,\n): InfraProvider | undefined {\n switch (kind) {\n case BackingServiceKind.MONGODB:\n if (source === BackingServiceSource.SELF) return InfraProvider.MONGODB_SELF;\n if (source === BackingServiceSource.MANAGED && provider === 'atlas') return InfraProvider.MONGODB_ATLAS;\n // Other Mongo managed brands (e.g., AWS DocumentDB) — extend\n // the `InfraProvider` enum + this branch in the same slice\n // that adds the first concrete consumer.\n return undefined;\n case BackingServiceKind.POSTGRESQL:\n if (source === BackingServiceSource.SELF) return InfraProvider.POSTGRES_SELF;\n if (source === BackingServiceSource.MANAGED) {\n switch (provider) {\n case 'aws-rds': return InfraProvider.POSTGRES_AWS_RDS;\n case 'gcp-cloud-sql': return InfraProvider.POSTGRES_GCP_CLOUD_SQL;\n case 'azure-database': return InfraProvider.POSTGRES_AZURE_DATABASE;\n case 'supabase': return InfraProvider.POSTGRES_SUPABASE;\n case 'neon': return InfraProvider.POSTGRES_NEON;\n case 'render': return InfraProvider.POSTGRES_RENDER;\n // Generic fallback when the operator has authored\n // `source: MANAGED` without naming a brand (or with an\n // unrecognized brand). Acceptable while the brand catalog\n // is incomplete — the lockfile records `POSTGRES_MANAGED`\n // and the planner can still emit env vars + compose\n // contributions; brand-specific runtime behavior is what\n // the named-brand modules (Slice 4.B+) layer on top.\n default: return InfraProvider.POSTGRES_MANAGED;\n }\n }\n return undefined;\n case BackingServiceKind.REDIS:\n if (source === BackingServiceSource.SELF) return InfraProvider.REDIS_SELF;\n // Managed Redis brands (ElastiCache, Upstash, Redis Cloud, …)\n // — not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.RABBITMQ:\n if (source === BackingServiceSource.SELF) return InfraProvider.RABBITMQ_SELF;\n // Managed RabbitMQ brands (CloudAMQP, AWS MQ, …) —\n // not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.S3:\n // S3 dispatch is brand-first because the protocol is\n // standardized (S3-compatible) and the same `source` can host\n // multiple software stacks — `source: SELF` could be MinIO or\n // a self-managed AWS S3 cluster (theoretically). The brand is\n // the canonical disambiguator.\n if (provider === 'minio') return InfraProvider.MINIO_SELF;\n if (provider === 'aws') return InfraProvider.AWS_S3;\n // Default source-based mapping for unbranded S3 — MinIO is\n // the canonical self-hosted; AWS is the canonical managed.\n if (source === BackingServiceSource.SELF) return InfraProvider.MINIO_SELF;\n if (source === BackingServiceSource.MANAGED) return InfraProvider.AWS_S3;\n return undefined;\n case BackingServiceKind.CLAMAV:\n if (source === BackingServiceSource.SELF) return InfraProvider.CLAMAV_SELF;\n return undefined;\n case BackingServiceKind.IMMUDB:\n if (source === BackingServiceSource.SELF) return InfraProvider.IMMUDB_SELF;\n // Managed immudb (immudb Vault) — not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.BACKUP:\n // No concrete `InfraProvider` declared yet for this kind. Extend the `InfraProvider` enum +\n // this branch in the same slice that introduces the first concrete provider for it.\n //\n // `METRICS` was the other kind here and was WITHDRAWN 2026-09-09: telemetry is authored at\n // `observability.telemetry` and its auth header derived from the selected\n // `OBSERVABILITY_TELEMETRY` provider, so a backing-service kind was a third declaration\n // surface that nothing read. See `RUNTIME_GRANTED_INFRA_CAPABILITIES`.\n return undefined;\n }\n}\n/** @wildo_source:part:end platform.config.infra-provider-resolution */\n"]}
1
+ {"version":3,"file":"backing-services.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/backing-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAN,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,2CAAqB,CAAA;IACrB,+BAAS,CAAA;IACT,+CAAyB,CAAA;IACzB,uCAAiB,CAAA;IACjB;;;;OAIG;IACH,uCAAiB,CAAA;IACjB;;OAEG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAjBW,kBAAkB,KAAlB,kBAAkB,QAiB7B;AAED;;;;;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C5B,4FAA4F;YAC5F,oFAAoF;YACpF,EAAE;YACF,2FAA2F;YAC3F,0EAA0E;YAC1E,wFAAwF;YACxF,uEAAuE;YACvE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AACD,uEAAuE","sourcesContent":["import { z } from 'zod';\nimport {\n InfraCapability,\n InfraProvider,\n} from './infra-providers.schemas';\n\n/**\n * The backing-service authoring surface of `wildo.infra.<env>.config.ts`.\n *\n * Import from `@wildo-ai/platform-config-lib`. Everything below is what an\n * environment file may declare under `backingServices: { ... }` — the closed kind\n * vocabulary, the hosting-model axis, and the per-kind entry shape. The\n * `InfraCapability` / `InfraProvider` projections further down this file are\n * planner-internal and deliberately outside the anchor: an app author never writes\n * them.\n *\n * Declare a kind ONLY when the environment actually runs it — keys are optional so a\n * flattened app declaration stays truthful about what it enables. Omitting a kind an\n * enabled engine capability depends on is the classic silent-degradation bug: e.g.\n * `COMPLIANCE_AUDIT_TRAIL` without `immudb` leaves the tamper-evident audit store\n * unbacked, which `wildo config sync` reports as a warning per environment.\n *\n * @wildo_source:part:start platform.config.backing-services facet:layer:platform facet:family:infra\n */\nexport enum BackingServiceKind {\n MONGODB = 'mongodb',\n REDIS = 'redis',\n RABBITMQ = 'rabbitmq',\n S3 = 's3',\n POSTGRESQL = 'postgresql',\n CLAMAV = 'clamav',\n /**\n * immudb — an immutable, cryptographically-verifiable database used as a\n * tamper-evident audit-log store (fills the `AUDIT_LOG_STORAGE` capability).\n * A stateful DB: a data volume in dev, self-hosted or immudb Vault in prod.\n */\n IMMUDB = 'immudb',\n /**\n * Backup orchestration target. Stateless base for now.\n */\n BACKUP = 'backup',\n}\n\n/**\n * Hosting model of a backing service instance — the orthogonal axis to\n * the **brand** (which is captured by the per-kind `provider` field).\n *\n * - `self`: self-hosted (Docker/K8s container managed by the platform,\n * or operator-managed on-prem). Brands here are open-source\n * software names (e.g. MinIO for S3, vanilla Postgres / MongoDB).\n * - `managed`: external vendor-managed service. Brands here are\n * vendor names (e.g. `'atlas'` for MongoDB Atlas, `'aws-rds'` for\n * AWS RDS, `'supabase'` for Supabase Postgres, `'aws'` for AWS S3).\n *\n * **Slice 4.B.0 reshape (2026-05-07)**: the `ATLAS` value was removed.\n * Pre-reshape `source: ATLAS` becomes `source: MANAGED, provider:\n * 'atlas'`. The reshape generalizes from \"Mongo + S3 are the only\n * brand-aware kinds\" to \"every kind can be brand-aware when the\n * managed market has multiple vendors\" — Postgres in particular\n * (RDS / GCP Cloud SQL / Supabase / Neon / Render / Azure).\n */\nexport enum BackingServiceSource {\n SELF = 'self',\n MANAGED = 'managed',\n}\n\n/**\n * Common fields every backing-service entry shares.\n *\n * Per-kind extensions add the fields that are SEMANTICALLY meaningful\n * for that kind only. Slice 3 closeout (M-4 + L-5): the previous shared\n * `BackingServiceEnvConfigSchema` collapsed `database` into a\n * `union(int, string)` and put `name` only on Mongo; both compromised\n * the framework-mindset rule that \"every field must carry its semantic\n * weight\". The split below means a typo like `redis: { database:\n * 'staging' }` (string on a kind that needs an integer DB index) is\n * rejected at parse time instead of crashing the runtime client at\n * connect time.\n */\nconst BackingServiceBaseSchema = z.object({\n source: z.enum(BackingServiceSource),\n /**\n * Brand of the backing service. Orthogonal to `source` (hosting\n * model). Required-in-spirit when `source === MANAGED` and the\n * managed market has multiple vendors (Mongo: `'atlas'` /\n * `'aws-documentdb'` / …; Postgres: `'aws-rds'` / `'gcp-cloud-sql'`\n * / `'supabase'` / `'neon'` / `'render'` / `'azure-database'`;\n * S3: `'aws'` / `'cloudflare-r2'` / …); optional when `source ===\n * SELF` (e.g. S3-self-hosted defaults to MinIO; `provider:\n * 'minio'` is allowed but redundant).\n *\n * Modeled as `z.string().optional()` rather than per-kind enum\n * unions to keep this base schema simple — the canonical brand\n * vocabulary lives in `resolveInfraProvider`'s dispatch table\n * (each kind documents which brand strings it recognizes; unknown\n * brands fall back to the kind's generic `<KIND>_MANAGED` /\n * `<KIND>_SELF` entry where one exists, otherwise return\n * `undefined`).\n *\n * Slice 4.B.0 (2026-05-07) generalized this from \"S3-only\" to\n * every brand-aware kind.\n */\n provider: z.string().min(1).optional(),\n /**\n * Override the catalog-derived hostname for this kind. Honored at\n * `HOST_FACING` perspective (always) and at `CONTAINER_INTERNAL` for\n * `MANAGED` sources. SELF + `CONTAINER_INTERNAL` keeps the catalog\n * container name because that is the only DNS the container network\n * can resolve.\n */\n host: z.string().min(1).optional(),\n /**\n * Override the catalog-derived listen port. Threaded into both\n * docker-compose `<authored>:<authored>` publish and the per-app\n * env-vars (`<KIND>_PORT`).\n */\n port: z.number().int().positive().optional(),\n}).strict();\n\n/**\n * MongoDB backing service. `database` is the database NAME (string).\n *\n * Mongo's connection URL has the shape `mongodb://host:port/<database>`\n * — this string corresponds to the path segment. Pre-3 the field was\n * `name`; renamed to `database` in Slice 3 closeout (L-5) so all\n * data-store kinds use the same property name for the same concept\n * (vs. Postgres which already used `database`).\n */\nexport const MongoBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type MongoBackingService = z.infer<typeof MongoBackingServiceSchema>;\n\n/**\n * Redis backing service. `database` is the LOGICAL DB INDEX (integer).\n *\n * Redis exposes 16 logical databases (0–15) on a single connection.\n * Authoring a string here (e.g. `'staging'`) would silently parse on\n * the pre-3 union schema and crash ioredis at connect; the integer\n * constraint with `max(15)` fails loud at parse time.\n */\nexport const RedisBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.number().int().min(0).max(15).optional(),\n}).strict();\nexport type RedisBackingService = z.infer<typeof RedisBackingServiceSchema>;\n\n/**\n * PostgreSQL backing service. `database` is the database NAME (string).\n *\n * Symmetric with `MongoBackingService.database` — both are the\n * database identifier in their respective connection URLs.\n */\nexport const PostgresBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type PostgresBackingService = z.infer<typeof PostgresBackingServiceSchema>;\n\n/**\n * RabbitMQ backing service. `vhost` is the RabbitMQ virtual host.\n *\n * AMQP virtual hosts isolate exchange/queue namespaces inside a single\n * broker. NOT a database — RabbitMQ has no DB concept — so the field\n * is intentionally NOT named `database`.\n */\nexport const RabbitBackingServiceSchema = BackingServiceBaseSchema.extend({\n vhost: z.string().min(1).optional(),\n}).strict();\nexport type RabbitBackingService = z.infer<typeof RabbitBackingServiceSchema>;\n\n/**\n * S3-compatible backing service (MinIO, Scaleway Object Storage, AWS).\n *\n * `endpoint` is a URL (`http://localhost:9000`, `https://s3.eu-west.amazonaws.com`)\n * — the resolver parses it into host/port. `bucket` is the S3 bucket\n * name. NOT a database — S3 has no DB concept.\n */\nexport const S3BackingServiceSchema = BackingServiceBaseSchema.extend({\n endpoint: z.string().min(1).optional(),\n bucket: z.string().min(1).optional(),\n}).strict();\nexport type S3BackingService = z.infer<typeof S3BackingServiceSchema>;\n\n/** ClamAV anti-virus daemon. Stateless, no database/vhost/bucket. */\nexport const ClamAvBackingServiceSchema = BackingServiceBaseSchema;\nexport type ClamAvBackingService = z.infer<typeof ClamAvBackingServiceSchema>;\n\n/**\n * immudb backing service (tamper-evident audit-log store). A stateful DB —\n * `database` names the immudb database (defaults to `defaultdb` at runtime);\n * credentials come from the secrets pipeline like every other backing service.\n *\n * Declare this in EVERY environment where the `COMPLIANCE_AUDIT_TRAIL` engine\n * capability is enabled. `wildo config sync` warns per environment when the audit\n * capability is on but no environment declares an audit store, and the audit client\n * then has nowhere tamper-evident to write.\n *\n * You do NOT author the state-signing keypair that makes the store's\n * whole-server-substitution defense work. The framework provisions it (private half\n * mounted into a `source: SELF` immudb via `--signingKey`, public half pinned by the\n * audit client as `IMMUDB_STATE_PUBLIC_KEY`) — declaring the service is the whole job.\n *\n * @example\n * ```ts\n * backingServices: {\n * immudb: { source: BackingServiceSource.SELF },\n * }\n * ```\n */\nexport const ImmudbBackingServiceSchema = BackingServiceBaseSchema.extend({\n database: z.string().min(1).optional(),\n}).strict();\nexport type ImmudbBackingService = z.infer<typeof ImmudbBackingServiceSchema>;\n\n/**\n * Backup orchestration target. Stateless base for now.\n */\nexport const BackupBackingServiceSchema = BackingServiceBaseSchema;\nexport type BackupBackingService = z.infer<typeof BackupBackingServiceSchema>;\n\n/**\n * Discriminated UNION over all backing-service kinds. Used by the\n * `ServiceAddressResolver` and helpers that accept any kind and read\n * only base fields (`source`, `host`, `port`). Consumers that need\n * kind-specific fields MUST narrow first (e.g. via the per-kind type\n * exports above).\n */\nexport type BackingServiceEnvConfig =\n | MongoBackingService\n | RedisBackingService\n | PostgresBackingService\n | RabbitBackingService\n | S3BackingService\n | ClamAvBackingService\n | ImmudbBackingService\n | BackupBackingService;\n\n/**\n * Per-environment backing services config (source for each service).\n * Used in environment-specific infra descriptors.\n *\n * Keys stay optional because an app-owned environment only needs to declare the\n * backing services it actually enables. Requiring the full enum-keyed record\n * would force disabled services (for example `postgresql`) into every env file\n * and breaks truthful flattened targeted-app declarations.\n */\nexport const BackingServicesEnvConfigSchema = z.object({\n [BackingServiceKind.MONGODB]: MongoBackingServiceSchema.optional(),\n [BackingServiceKind.REDIS]: RedisBackingServiceSchema.optional(),\n [BackingServiceKind.RABBITMQ]: RabbitBackingServiceSchema.optional(),\n [BackingServiceKind.S3]: S3BackingServiceSchema.optional(),\n [BackingServiceKind.POSTGRESQL]: PostgresBackingServiceSchema.optional(),\n [BackingServiceKind.CLAMAV]: ClamAvBackingServiceSchema.optional(),\n [BackingServiceKind.IMMUDB]: ImmudbBackingServiceSchema.optional(),\n [BackingServiceKind.BACKUP]: BackupBackingServiceSchema.optional(),\n}).strict();\nexport type BackingServicesEnvConfig = z.infer<typeof BackingServicesEnvConfigSchema>;\n/** @wildo_source:part:end platform.config.backing-services */\n\n// =============================================================================\n// BackingServiceKind ↔ InfraCapability / InfraProvider projections\n// =============================================================================\n//\n// Per `infra-provider-planner.md` R-B (locked 2026-05-06): `BackingServicesEnvConfig`\n// IS the canonical per-env infra-selection authoring surface. The\n// `InfraCapability` / `InfraProvider` enums are the planner's projection\n// vocabulary (used by `InfraProviderModule.supportedCapabilities`,\n// `wildo-saas.lock.json sections.infra` keying, and any tooling that\n// walks \"what infra is selected per env\"). The mappings below are the\n// single source of truth for that projection — no other code may\n// reconstruct them locally.\n\n/** @wildo_source:part:start platform.config.infra-provider-resolution facet:layer:platform facet:audience:app-developer */\n/**\n * `BackingServiceKind` → `InfraCapability`. Every extension to `BackingServiceKind` MUST extend this\n * map in the same commit, otherwise the planner cannot project the new kind to its capability slot.\n *\n * INJECTIVE, not bijective — and the difference is a real property of the model rather than a gap.\n * A capability may be granted to a runtime without any environment declaring a backing service for\n * it; see {@link RUNTIME_GRANTED_INFRA_CAPABILITIES} for the ones that are, and why.\n */\nexport const BackingServiceKindToInfraCapability: Record<BackingServiceKind, InfraCapability> = {\n [BackingServiceKind.MONGODB]: InfraCapability.DOCUMENT_DATABASE,\n [BackingServiceKind.POSTGRESQL]: InfraCapability.RELATIONAL_DATABASE,\n [BackingServiceKind.RABBITMQ]: InfraCapability.QUEUING_SYSTEM,\n [BackingServiceKind.REDIS]: InfraCapability.CACHE_MANAGER,\n [BackingServiceKind.S3]: InfraCapability.OBJECT_STORAGE,\n [BackingServiceKind.CLAMAV]: InfraCapability.ANTIVIRUS_SCANNING,\n [BackingServiceKind.IMMUDB]: InfraCapability.AUDIT_LOG_STORAGE,\n [BackingServiceKind.BACKUP]: InfraCapability.BACKUP_MANAGER,\n};\n\n/**\n * Project `(BackingServiceKind, source, provider?)` → `InfraProvider`.\n *\n * The three-axis dispatch (kind × hosting-model × brand) generalizes\n * the source/brand split across all kinds (Slice 4.B.0, 2026-05-07\n * — was source-only with Atlas as a special source value before).\n *\n * **Brand vocabulary** per kind (`provider` field on the authored\n * `BackingService<X>Schema`):\n *\n * | Kind | source | provider | InfraProvider |\n * |---|---|---|---|\n * | `MONGODB` | `SELF` | (any) | `MONGODB_SELF` |\n * | `MONGODB` | `MANAGED` | `'atlas'` | `MONGODB_ATLAS` |\n * | `POSTGRESQL` | `SELF` | (any) | `POSTGRES_SELF` |\n * | `POSTGRESQL` | `MANAGED` | `'aws-rds'` | `POSTGRES_AWS_RDS` |\n * | `POSTGRESQL` | `MANAGED` | `'gcp-cloud-sql'` | `POSTGRES_GCP_CLOUD_SQL` |\n * | `POSTGRESQL` | `MANAGED` | `'azure-database'` | `POSTGRES_AZURE_DATABASE` |\n * | `POSTGRESQL` | `MANAGED` | `'supabase'` | `POSTGRES_SUPABASE` |\n * | `POSTGRESQL` | `MANAGED` | `'neon'` | `POSTGRES_NEON` |\n * | `POSTGRESQL` | `MANAGED` | `'render'` | `POSTGRES_RENDER` |\n * | `POSTGRESQL` | `MANAGED` | unset or unrecognized | `POSTGRES_MANAGED` (generic fallback) |\n * | `REDIS` | `SELF` | (any) | `REDIS_SELF` |\n * | `RABBITMQ` | `SELF` | (any) | `RABBITMQ_SELF` |\n * | `S3` | (either) | `'minio'` | `MINIO_SELF` |\n * | `S3` | (either) | `'aws'` | `AWS_S3` |\n * | `S3` | `SELF` | unset or unrecognized | `MINIO_SELF` |\n * | `S3` | `MANAGED` | unset or unrecognized | `AWS_S3` |\n * | `CLAMAV` | `SELF` | (any) | `CLAMAV_SELF` |\n * | `IMMUDB` | `SELF` | (any) | `IMMUDB_SELF` |\n *\n * Returns `undefined` for combinations not in the table — for kinds\n * whose `InfraProvider` catalog has no concrete entry yet (BACKUP)\n * and for unrecognized managed Mongo brands. PostgreSQL has a generic\n * managed fallback; S3 uses brand-first resolution, then source-based defaults. Callers decide whether `undefined` is fail-closed\n * (planner running with unknown infra catalog) or accepted (lockfile\n * pre-declaration).\n *\n * ## What this means when you author an environment\n *\n * **`MANAGED` does not reach every kind.** The table above is the whole of it: a managed vendor\n * resolves for the relational database (six named brands plus a generic fallback), the document\n * database (`'atlas'` only) and object storage. Declaring `{ source: MANAGED }` on the cache, the\n * broker, the antivirus scanner, the audit store or the backup target resolves to NOTHING — those\n * kinds are self-hosted only until their vendor catalogue is built.\n *\n * **And nothing tells you.** A kind that resolves to no provider is SKIPPED when the lockfile's infra\n * section is materialised, silently, because recording an entry with no provider would lie. So a\n * managed declaration the catalogue cannot serve looks exactly like a correct one: `wildo config\n * sync` succeeds, the file says `MANAGED`, and the environment has no managed anything. Read the\n * lockfile's infra section to see which of your declarations were actually resolved.\n *\n * **An unrecognised brand is not the same failure on every kind.** On the relational database it\n * falls back to the generic managed entry, so a typo still resolves. On the document database,\n * an unknown managed brand resolves to nothing. Object storage recognizes minio/aws first, then\n * falls back by source: SELF to MinIO, MANAGED to AWS S3, including unrecognized brands.\n *\n * **Provider resolution and workload inclusion answer different questions.** Compose and Kubernetes\n * both use the same per-kind inclusion policy, separately from catalogue resolution. Cache, broker\n * and S3 default to self-hosted unless explicitly MANAGED; ClamAV and immudb require explicit SELF.\n * MongoDB and PostgreSQL also include the platform database requirement: an application-level\n * managed choice does not remove a self-hosted database still needed by the platform. Backup has\n * no rendered workload. Do not infer workload inclusion from this provider resolver.\n */\nexport function resolveInfraProvider(\n kind: BackingServiceKind,\n source: BackingServiceSource,\n provider?: string,\n): InfraProvider | undefined {\n switch (kind) {\n case BackingServiceKind.MONGODB:\n if (source === BackingServiceSource.SELF) return InfraProvider.MONGODB_SELF;\n if (source === BackingServiceSource.MANAGED && provider === 'atlas') return InfraProvider.MONGODB_ATLAS;\n // Other Mongo managed brands (e.g., AWS DocumentDB) — extend\n // the `InfraProvider` enum + this branch in the same slice\n // that adds the first concrete consumer.\n return undefined;\n case BackingServiceKind.POSTGRESQL:\n if (source === BackingServiceSource.SELF) return InfraProvider.POSTGRES_SELF;\n if (source === BackingServiceSource.MANAGED) {\n switch (provider) {\n case 'aws-rds': return InfraProvider.POSTGRES_AWS_RDS;\n case 'gcp-cloud-sql': return InfraProvider.POSTGRES_GCP_CLOUD_SQL;\n case 'azure-database': return InfraProvider.POSTGRES_AZURE_DATABASE;\n case 'supabase': return InfraProvider.POSTGRES_SUPABASE;\n case 'neon': return InfraProvider.POSTGRES_NEON;\n case 'render': return InfraProvider.POSTGRES_RENDER;\n // Generic fallback when the operator has authored\n // `source: MANAGED` without naming a brand (or with an\n // unrecognized brand). Acceptable while the brand catalog\n // is incomplete — the lockfile records `POSTGRES_MANAGED`\n // and the planner can still emit env vars + compose\n // contributions; brand-specific runtime behavior is what\n // the named-brand modules (Slice 4.B+) layer on top.\n default: return InfraProvider.POSTGRES_MANAGED;\n }\n }\n return undefined;\n case BackingServiceKind.REDIS:\n if (source === BackingServiceSource.SELF) return InfraProvider.REDIS_SELF;\n // Managed Redis brands (ElastiCache, Upstash, Redis Cloud, …)\n // — not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.RABBITMQ:\n if (source === BackingServiceSource.SELF) return InfraProvider.RABBITMQ_SELF;\n // Managed RabbitMQ brands (CloudAMQP, AWS MQ, …) —\n // not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.S3:\n // S3 dispatch is brand-first because the protocol is\n // standardized (S3-compatible) and the same `source` can host\n // multiple software stacks — `source: SELF` could be MinIO or\n // a self-managed AWS S3 cluster (theoretically). The brand is\n // the canonical disambiguator.\n if (provider === 'minio') return InfraProvider.MINIO_SELF;\n if (provider === 'aws') return InfraProvider.AWS_S3;\n // Default source-based mapping for unbranded S3 — MinIO is\n // the canonical self-hosted; AWS is the canonical managed.\n if (source === BackingServiceSource.SELF) return InfraProvider.MINIO_SELF;\n if (source === BackingServiceSource.MANAGED) return InfraProvider.AWS_S3;\n return undefined;\n case BackingServiceKind.CLAMAV:\n if (source === BackingServiceSource.SELF) return InfraProvider.CLAMAV_SELF;\n return undefined;\n case BackingServiceKind.IMMUDB:\n if (source === BackingServiceSource.SELF) return InfraProvider.IMMUDB_SELF;\n // Managed immudb (immudb Vault) — not catalogued yet; future expansion.\n return undefined;\n case BackingServiceKind.BACKUP:\n // No concrete `InfraProvider` declared yet for this kind. Extend the `InfraProvider` enum +\n // this branch in the same slice that introduces the first concrete provider for it.\n //\n // `METRICS` was the other kind here and was WITHDRAWN 2026-09-09: telemetry is authored at\n // `observability.telemetry` and its auth header derived from the selected\n // `OBSERVABILITY_TELEMETRY` provider, so a backing-service kind was a third declaration\n // surface that nothing read. See `RUNTIME_GRANTED_INFRA_CAPABILITIES`.\n return undefined;\n }\n}\n/** @wildo_source:part:end platform.config.infra-provider-resolution */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.example.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/cdn.example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AAEH,kHAAkH;AAIlH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAY1E,CAAC;AACF,0DAA0D;AAE1D,+GAA+G;AAK/G,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAKvE,CAAC;AACF,uDAAuD"}
1
+ {"version":3,"file":"cdn.example.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/cdn.example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AAEH,kHAAkH;AAIlH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAY1E,CAAC;AACF,0DAA0D;AAE1D,+GAA+G;AAK/G,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAKvE,CAAC;AACF,uDAAuD"}
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.schemas.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/cdn.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;GAcG;AACH,oBAAY,SAAS;IACnB;;;;;;OAMG;IACH,OAAO,YAAY;IACnB;;;;;;;;OAQG;IACH,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM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eAAO,MAAM,aAAa,EAAE,QAAQ,CAClC,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAKjD,CAAC"}
1
+ {"version":3,"file":"csp-defaults.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CACrD,CAAC;AAgHF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAClC,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAKjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"csp-emit.d.ts","sourceRoot":"","sources":["../../../../src/project-config/shared/csp-emit.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEf,KAAK,4BAA4B,EAClC,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CACrD,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WA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,CAAC,WAAW,EAAE,CAAC;gBACjB,KAAK,CAAC,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC;gBAC/E,KAAK,GAAG,cAAc,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;gBAClD,YAAY,IAAI,CAAC,CAAC;YACpB,CAAC;YAED,cAAc,GAAG,IAAI,CAAC;YACtB,UAAU,GAAG,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IAED,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,cAAc,QAAQ,qBAAqB,sBAAsB,sBAAsB,cAAc,GAAG,CAAC,EAAE,CAC5G,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport {\n AppFrontendType,\n ProviderFrontendCspOriginBucket,\n type ProviderFrontendCspFootprint,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n CSP_BASELINES,\n type CspBaselineDirectiveMap,\n} from './csp-defaults';\nimport {\n CspMergeStrategy,\n type CspDirectiveName,\n type EnvCspOverride,\n type WildoCspConfig,\n} from './csp.schemas';\nimport { WildoEnvironment } from './environment.schemas';\n\nexport type ResolvedCspDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\nexport interface ResolvedCspPolicy {\n readonly directives: ResolvedCspDirectiveMap;\n readonly reportOnly: boolean;\n readonly reportUri: string | undefined;\n}\n\nexport interface CspEmitArtifacts {\n readonly nginxHeaderName: string;\n readonly nginxPolicyValue: string;\n readonly nginxAddHeaderLine: string;\n readonly metaTag:\n | {\n readonly tagName: 'meta';\n readonly attributes: {\n readonly 'http-equiv': string;\n readonly content: string;\n };\n }\n | null;\n}\n\n/**\n * Where each of a provider's declared origin buckets lands in the policy.\n *\n * THE ONE PLACE the mapping exists. A provider declares what it is REACHING\n * — a script it loads, an API it calls, an iframe it embeds — and which\n * directive grades that fetch is framework knowledge, so a provider author\n * never has to learn the CSP directive taxonomy and a change to it is a change\n * here rather than in every provider package.\n *\n * The bucket names are also why `ProviderFrontendCspFootprint` does not restate\n * `CSP_DIRECTIVE_NAMES`: that vocabulary already has one named source, in this\n * package, and `@wildo-ai/saas-models` — where the footprint has to live,\n * because it rides on the wire — depends on nothing of ours.\n *\n * Total over the footprint's buckets: adding a bucket without deciding its\n * directive is a compile error here, which is the coupling this shape exists\n * for. A bucket with no mapping would be authored, serialized, read, and\n * silently contribute nothing — in production only, since CSP is report-only\n * in development.\n */\nconst PROVIDER_CSP_BUCKET_DIRECTIVES: Readonly<\n Record<ProviderFrontendCspOriginBucket, CspDirectiveName>\n> = {\n [ProviderFrontendCspOriginBucket.SCRIPT]: 'script-src',\n [ProviderFrontendCspOriginBucket.CONNECT]: 'connect-src',\n [ProviderFrontendCspOriginBucket.FRAME]: 'frame-src',\n [ProviderFrontendCspOriginBucket.IMG]: 'img-src',\n [ProviderFrontendCspOriginBucket.STYLE]: 'style-src',\n [ProviderFrontendCspOriginBucket.FONT]: 'font-src',\n};\n\nexport interface ResolveCspPolicyInput {\n readonly frontendType: AppFrontendType;\n readonly appCsp: WildoCspConfig | undefined;\n readonly envOverride?: EnvCspOverride;\n /**\n * The CSP footprints of the providers DECLARED for this service — the fourth\n * layer, added by #332.\n *\n * Without it, a marketing site that wants an embedded meeting or a SaaS app\n * that wants a Drive picker means hand-editing script / frame / connect\n * origins per application, per service, per environment; and getting it wrong\n * is invisible until production, because development is report-only. The\n * caller reads these from the service's materialized provider block, which is\n * DATA precisely so that no frontend module has to be executed to obtain them.\n *\n * Providers declared for ANOTHER service must not appear here: the point of\n * the layer is that a Zoom origin admitted for the marketing site is not\n * thereby admitted for the SaaS app.\n *\n * A footprint's `derivedOrigins` must ALREADY BE RESOLVED into its buckets by\n * the caller. This resolver sees no `publicConfig` — it composes a policy, it\n * does not read a provider's configuration — and the one caller that has both\n * halves is `CspSyncService`, which reads each entry out of the materialized\n * block.\n */\n readonly providerCspFootprints?: ReadonlyArray<ProviderFrontendCspFootprint>;\n /**\n * Environment id this CSP is being resolved for (e.g. `'local'`,\n * `'staging'`, `'production'`, or any custom slug). Optional for\n * back-compat — when `undefined`, no env-aware auto-loosening applies\n * (the resolver behaves exactly as it did pre-`viteDevLoosening`).\n *\n * Required when the caller wants the framework to auto-apply\n * `viteDevLoosening` for `'local'` + `SAAS_APP`. The CLI's\n * `CspSyncService` already knows the env id and SHOULD pass it.\n */\n readonly environmentId?: string;\n}\n\nexport const NGINX_CSP_BEGIN_MARKER = '# >>> wildo csp begin';\nexport const NGINX_CSP_END_MARKER = '# <<< wildo csp end';\n\nconst META_INVALID_DIRECTIVES: ReadonlySet<string> = new Set([\n 'frame-ancestors',\n 'report-uri',\n 'report-to',\n 'sandbox',\n]);\n\n/**\n * Derives the WebSocket-scheme companion origins for every HTTP(S) origin\n * present in a `connect-src` source list, and returns the list widened to\n * include them.\n *\n * Why the framework ships this rather than making each app author it:\n * every Wildo backend serves its realtime channel (Socket.IO) on the SAME\n * origin as its HTTP API. Socket.IO opens the handshake over polling and\n * then UPGRADES to a raw `ws://` / `wss://` connection to that origin. The\n * CSP `connect-src` directive grades WebSocket connections by their `ws`/\n * `wss` scheme, and — per the CSP spec — an `http://host` source does NOT\n * authorize a `ws://host` connection (the schemes are distinct match\n * tokens). So an app that allow-lists `http://localhost:4241` for `fetch`/\n * `XHR` but not `ws://localhost:4241` will emit a `connect-src` violation\n * the instant the socket upgrades — exactly the trap every infra config\n * would otherwise have to remember to work around by hand.\n *\n * Transform (idempotent, dedupe-safe):\n * `http://host[:port]` → also allow `ws://host[:port]`\n * `https://host[:port]` → also allow `wss://host[:port]`\n * bare scheme `http:` → also allow `ws:`\n * bare scheme `https:` → also allow `wss:`\n *\n * Keyword / non-HTTP sources (`'self'`, `'none'`, `data:`, `blob:`, an\n * already-`ws://` origin, …) are passed through untouched. `'self'` is\n * deliberately NOT expanded: the browser tab is served from the frontend\n * origin, never the backend API origin, so a same-origin `ws` derivation\n * from `'self'` would authorize the wrong host. The backend origin is\n * always listed explicitly, which is what this widens.\n */\nfunction augmentConnectSrcWithWebSocketOrigins(\n sources: readonly string[] | undefined,\n): readonly string[] | undefined {\n if (!sources || sources.length === 0) {\n return sources;\n }\n\n const derived: string[] = [];\n for (const source of sources) {\n if (source.startsWith('https://')) {\n derived.push(`wss://${source.slice('https://'.length)}`);\n } else if (source.startsWith('http://')) {\n derived.push(`ws://${source.slice('http://'.length)}`);\n } else if (source === 'https:') {\n derived.push('wss:');\n } else if (source === 'http:') {\n derived.push('ws:');\n }\n }\n\n return mergeSourceLists(sources, derived);\n}\n\nfunction mergeSourceLists(\n a: readonly string[] | undefined,\n b: readonly string[] | undefined,\n): readonly string[] {\n if (!a || a.length === 0) {\n return b ?? [];\n }\n if (!b || b.length === 0) {\n return a;\n }\n\n const seen = new Set(a);\n const out: string[] = [...a];\n for (const source of b) {\n if (!seen.has(source)) {\n seen.add(source);\n out.push(source);\n }\n }\n return out;\n}\n\n/**\n * Resolves the generic layered CSP model shared by all frontend surfaces:\n * platform baseline, app-static config, env-selected overrides, then the\n * declared providers' own footprints (#332).\n *\n * The provider layer is fourth on purpose. The first three describe what the\n * APPLICATION decided; the fourth describes what the things the application\n * declared actually need in order to work. Placing it last means a provider\n * cannot be silently dropped by an app-level `REPLACE_BASELINE`, and placing it\n * before the WebSocket derivation means a provider's `connect-src` origin gets\n * its `wss://` companion exactly like the backend API's.\n *\n * This lives with the CSP schemas/defaults so consumers do not depend on any\n * concrete frontend package to process security config.\n */\nexport function resolveCspPolicy(\n input: ResolveCspPolicyInput,\n): ResolvedCspPolicy | null {\n const { frontendType, appCsp, envOverride } = input;\n\n if (!appCsp || !appCsp.enabled) {\n return null;\n }\n\n const baseline: CspBaselineDirectiveMap = CSP_BASELINES[frontendType];\n let merged: ResolvedCspDirectiveMap;\n\n if (appCsp.mergeStrategy === CspMergeStrategy.REPLACE_BASELINE) {\n merged = appCsp.directives;\n } else {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n const allKeys = new Set<CspDirectiveName>([\n ...(Object.keys(baseline) as CspDirectiveName[]),\n ...(Object.keys(appCsp.directives) as CspDirectiveName[]),\n ]);\n\n for (const key of allKeys) {\n out[key] = mergeSourceLists(baseline[key], appCsp.directives[key]);\n }\n\n merged = out;\n }\n\n if (envOverride?.extraDirectives) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {\n ...merged,\n };\n\n for (const key of Object.keys(envOverride.extraDirectives) as CspDirectiveName[]) {\n out[key] = mergeSourceLists(merged[key], envOverride.extraDirectives[key]);\n }\n\n merged = out;\n }\n\n // Provider layer (#332) — the origins the providers DECLARED FOR THIS SERVICE\n // need, merged after the app-static and env layers and before the WebSocket\n // derivation below (so a provider's `connect-src` origin gets its `wss://`\n // companion for free, exactly like the backend API's).\n //\n // Additive in every merge strategy, including REPLACE_BASELINE. That strategy\n // exists so an app can discard the platform BASELINE when it is wrong for the\n // surface; a provider the same app declared is a dependency it chose, not a\n // default it is overriding, and silently dropping its origins would produce a\n // policy that blocks a feature the app asked for — in production only.\n const providerFootprints = input.providerCspFootprints ?? [];\n if (providerFootprints.length > 0) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = { ...merged };\n\n for (const footprint of providerFootprints) {\n for (const [bucket, directive] of Object.entries(PROVIDER_CSP_BUCKET_DIRECTIVES) as ReadonlyArray<\n readonly [ProviderFrontendCspOriginBucket, CspDirectiveName]\n >) {\n const origins = footprint[bucket];\n if (origins.length === 0) continue;\n out[directive] = mergeSourceLists(out[directive], origins);\n }\n }\n\n merged = out;\n }\n\n // Vite dev-mode loosening (auto-applied for local SAAS_APP).\n //\n // Vite's dev server REQUIRES both `'unsafe-eval'` (lazy module +\n // sourcemap transforms) and `'unsafe-inline'` (HMR client bootstrap\n // injects a literal inline `<script>`) to function. Under the tight\n // SAAS_APP baseline (`script-src 'self'`), those produce ~120+ CSP\n // violations per page load that drown out real signal (e.g. the\n // Google-Fonts gotcha that the loosened style-src/font-src now allow).\n //\n // The framework SHIPS this knowledge — every Wildo SaaS app uses\n // Vite — so we auto-loosen for `'local'` + `SAAS_APP` here rather\n // than forcing every infra config to re-author the same opt-in. An\n // explicit `viteDevLoosening: false` override keeps tight `script-src`\n // when an author is actively debugging a real CSP issue and willing\n // to accept the Vite noise. Production builds emit `<script\n // type=\"module\">` only and never `eval()`, so production envs never\n // trigger the auto-loosening — `viteDevLoosening` defaults to FALSE\n // there even if the env id is non-`local`.\n const isViteDevAutoTarget =\n input.environmentId === WildoEnvironment.LOCAL &&\n frontendType === AppFrontendType.SAAS_APP;\n const viteDevLoosening = envOverride?.viteDevLoosening ?? isViteDevAutoTarget;\n if (viteDevLoosening) {\n merged = {\n ...merged,\n 'script-src': mergeSourceLists(\n merged['script-src'],\n [\"'unsafe-inline'\", \"'unsafe-eval'\"],\n ),\n };\n }\n\n // Auto-derive the `ws://` / `wss://` companion origins for every HTTP(S)\n // origin the app allow-listed in `connect-src`. Applied LAST so it covers\n // origins contributed by the baseline, app-static config, AND env override\n // alike (e.g. the local `http://localhost:4241` and the staging/prod\n // `https://api.<app>.wildo.app` backend origins). Without this, the\n // Socket.IO transport upgrade to a raw WebSocket against the backend origin\n // trips a `connect-src` violation on every surface. See the helper JSDoc for\n // the scheme-matching rationale.\n const connectSrcWithWs = augmentConnectSrcWithWebSocketOrigins(merged['connect-src']);\n if (connectSrcWithWs !== merged['connect-src']) {\n merged = {\n ...merged,\n 'connect-src': connectSrcWithWs,\n };\n }\n\n return {\n directives: merged,\n reportOnly: envOverride?.reportOnly ?? appCsp.reportOnly,\n reportUri: envOverride?.reportUri ?? appCsp.reportUri,\n };\n}\n\nfunction serializeDirectives(directives: ResolvedCspDirectiveMap): string {\n return Object.entries(directives)\n .filter(([, sources]) => sources && sources.length > 0)\n .map(([name, sources]) => `${name} ${(sources ?? []).join(' ')}`)\n .join('; ');\n}\n\nfunction stripMetaInvalidDirectives(\n directives: ResolvedCspDirectiveMap,\n): ResolvedCspDirectiveMap {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n\n for (const [name, sources] of Object.entries(directives)) {\n if (!META_INVALID_DIRECTIVES.has(name)) {\n out[name as CspDirectiveName] = sources;\n }\n }\n\n return out;\n}\n\nfunction withReportUri(\n directives: ResolvedCspDirectiveMap,\n reportUri: string | undefined,\n): ResolvedCspDirectiveMap {\n if (!reportUri) {\n return directives;\n }\n\n return {\n ...directives,\n ['report-uri' as CspDirectiveName]: [reportUri],\n };\n}\n\nexport function emitCspArtifacts(policy: ResolvedCspPolicy): CspEmitArtifacts {\n const nginxHeaderName = policy.reportOnly\n ? 'Content-Security-Policy-Report-Only'\n : 'Content-Security-Policy';\n const nginxPolicyValue = serializeDirectives(\n withReportUri(policy.directives, policy.reportUri),\n );\n\n return {\n nginxHeaderName,\n nginxPolicyValue,\n nginxAddHeaderLine: `add_header ${nginxHeaderName} \"${nginxPolicyValue}\" always;`,\n metaTag: policy.reportOnly\n ? null\n : {\n tagName: 'meta',\n attributes: {\n 'http-equiv': 'Content-Security-Policy',\n content: serializeDirectives(stripMetaInvalidDirectives(policy.directives)),\n },\n },\n };\n}\n\n/**\n * A single static-host `_headers` block that delivers the resolved CSP as a\n * real response header at the `/*` (all-paths) scope.\n *\n * Format matches the `_headers` convention consumed by Cloudflare Pages /\n * Netlify / Vercel (and the `saas-website` `X-Robots-Tag` `_headers` emitter):\n * a path line, then two-space-indented `Header-Name: value` lines. This is the\n * PORTABLE, provider-agnostic edge-CSP delivery — a CDN-served frontend (which\n * has no nginx to `add_header`) ships this file in its bucket and any\n * `_headers`-aware host applies it.\n *\n * Uses the FULL header value (including the header-only `frame-ancestors` and\n * `report-uri` directives) — a `_headers` line is a genuine response header, so\n * nothing is stripped (unlike the `<meta http-equiv>` fallback). Report-only\n * policies are honoured (the header name flips to\n * `Content-Security-Policy-Report-Only`, valid on a real header channel).\n *\n * The caller composes this block with any other `_headers` blocks (e.g. the\n * website's per-path `X-Robots-Tag`) into one file, separated by a blank line.\n */\nexport function emitCspHeadersFileBlock(policy: ResolvedCspPolicy): string {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return `/*\\n ${nginxHeaderName}: ${nginxPolicyValue}`;\n}\n\n/**\n * Provider-agnostic descriptor of the response-header MODIFICATION a CDN vendor\n * must install to deliver the resolved CSP at the edge. A concrete vendor\n * adapter (e.g. Cloudflare) maps this to its own API shape — for Cloudflare, a\n * `http_response_headers_transform` ruleset rule whose action sets\n * `headerName` to `value`.\n *\n * Same FULL header name + value as the nginx / `_headers` channels (a CDN sets\n * a real header, so `frame-ancestors` / `report-uri` are valid and retained).\n */\nexport interface CspEdgeHeaderModification {\n /** Cloudflare ruleset phase this modification belongs to. */\n readonly phase: 'http_response_headers_transform';\n /** The header operation — always `set` (overwrite any origin value). */\n readonly operation: 'set';\n /** Response-header name (report-only-aware, same as the nginx channel). */\n readonly headerName: string;\n /** Serialized policy value (identical to `nginxPolicyValue`). */\n readonly value: string;\n}\n\n/**\n * Derive the edge response-header modification carrying the resolved CSP, for a\n * CDN vendor's live-provisioning adapter to install. Thin over\n * {@link emitCspArtifacts} so the directive serialization is the single source\n * of truth across nginx / `_headers` / CDN channels.\n */\nexport function emitCspEdgeHeaderModification(policy: ResolvedCspPolicy): CspEdgeHeaderModification {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return {\n phase: 'http_response_headers_transform',\n operation: 'set',\n headerName: nginxHeaderName,\n value: nginxPolicyValue,\n };\n}\n\nexport interface RewriteNginxResult {\n readonly totalPairs: number;\n readonly pairsRewritten: number;\n readonly fileWritten: boolean;\n}\n\nexport function rewriteNginxCspMarkerPairs(\n filePath: string,\n addHeaderLine: string,\n): RewriteNginxResult {\n const original = readFileSync(filePath, 'utf-8');\n const { rewritten, totalPairs, pairsChanged } = rewriteNginxCspMarkerPairsString(\n original,\n addHeaderLine,\n filePath,\n );\n const fileWritten = rewritten !== original;\n\n if (fileWritten) {\n writeFileSync(filePath, rewritten, 'utf-8');\n }\n\n return {\n totalPairs,\n pairsRewritten: pairsChanged,\n fileWritten,\n };\n}\n\nexport function rewriteNginxCspMarkerPairsString(\n source: string,\n addHeaderLine: string,\n filePath = '<in-memory>',\n): {\n readonly rewritten: string;\n readonly totalPairs: number;\n readonly pairsChanged: number;\n} {\n const usesCrlf = source.includes('\\r\\n');\n const newline = usesCrlf ? '\\r\\n' : '\\n';\n const lines = source.split(newline);\n\n let totalPairs = 0;\n let pairsChanged = 0;\n let openBeginIndex: number | null = null;\n let openIndent = '';\n\n for (let index = 0; index < lines.length; index += 1) {\n const trimmed = lines[index].trim();\n\n if (trimmed === NGINX_CSP_BEGIN_MARKER) {\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found a second '${NGINX_CSP_BEGIN_MARKER}' before the previous '${NGINX_CSP_END_MARKER}' (line ${openBeginIndex + 1})`,\n );\n }\n\n openBeginIndex = index;\n openIndent = lines[index].slice(0, lines[index].indexOf('#'));\n continue;\n }\n\n if (trimmed === NGINX_CSP_END_MARKER) {\n if (openBeginIndex === null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found '${NGINX_CSP_END_MARKER}' without a matching '${NGINX_CSP_BEGIN_MARKER}'`,\n );\n }\n\n totalPairs += 1;\n\n const existingBody = lines.slice(openBeginIndex + 1, index);\n const canonicalBody = [`${openIndent}${addHeaderLine}`];\n const existingNonBlank = existingBody.filter((line) => line.trim().length > 0);\n const canonicalNonBlank = canonicalBody.filter((line) => line.trim().length > 0);\n const bodyMatches =\n existingNonBlank.length === canonicalNonBlank.length &&\n existingNonBlank.every((line, bodyIndex) => line === canonicalNonBlank[bodyIndex]);\n\n if (!bodyMatches) {\n lines.splice(openBeginIndex + 1, index - openBeginIndex - 1, ...canonicalBody);\n index = openBeginIndex + canonicalBody.length + 1;\n pairsChanged += 1;\n }\n\n openBeginIndex = null;\n openIndent = '';\n }\n }\n\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath} has an unclosed '${NGINX_CSP_BEGIN_MARKER}' starting at line ${openBeginIndex + 1}`,\n );\n }\n\n return { rewritten: lines.join(newline), totalPairs, pairsChanged };\n}\n"]}
1
+ {"version":3,"file":"csp-emit.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,eAAe,EACf,+BAA+B,GAEhC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,GAIjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2BzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,8BAA8B,GAEhC;IACF,CAAC,+BAA+B,CAAC,MAAM,CAAC,EAAE,YAAY;IACtD,CAAC,+BAA+B,CAAC,OAAO,CAAC,EAAE,aAAa;IACxD,CAAC,+BAA+B,CAAC,KAAK,CAAC,EAAE,WAAW;IACpD,CAAC,+BAA+B,CAAC,GAAG,CAAC,EAAE,SAAS;IAChD,CAAC,+BAA+B,CAAC,KAAK,CAAC,EAAE,WAAW;IACpD,CAAC,+BAA+B,CAAC,IAAI,CAAC,EAAE,UAAU;CACnD,CAAC;AAyCF,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAE1D,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IAC3D,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,SAAS;CACV,CAAC,CAAC;AAEH;;;;;;;;;;;;;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":["import { readFileSync, writeFileSync } from 'node:fs';\nimport {\n AppFrontendType,\n ProviderFrontendCspOriginBucket,\n type ProviderFrontendCspFootprint,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n CSP_BASELINES,\n type CspBaselineDirectiveMap,\n} from './csp-defaults';\nimport {\n CspMergeStrategy,\n type CspDirectiveName,\n type EnvCspOverride,\n type WildoCspConfig,\n} from './csp.schemas';\nimport { WildoEnvironment } from './environment.schemas';\n\nexport type ResolvedCspDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\nexport interface ResolvedCspPolicy {\n readonly directives: ResolvedCspDirectiveMap;\n readonly reportOnly: boolean;\n readonly reportUri: string | undefined;\n}\n\nexport interface CspEmitArtifacts {\n readonly nginxHeaderName: string;\n readonly nginxPolicyValue: string;\n readonly nginxAddHeaderLine: string;\n readonly metaTag:\n | {\n readonly tagName: 'meta';\n readonly attributes: {\n readonly 'http-equiv': string;\n readonly content: string;\n };\n }\n | null;\n}\n\n/**\n * Where each of a provider's declared origin buckets lands in the policy.\n *\n * THE ONE PLACE the mapping exists. A provider declares what it is REACHING\n * — a script it loads, an API it calls, an iframe it embeds — and which\n * directive grades that fetch is framework knowledge, so a provider author\n * never has to learn the CSP directive taxonomy and a change to it is a change\n * here rather than in every provider package.\n *\n * The bucket names are also why `ProviderFrontendCspFootprint` does not restate\n * `CSP_DIRECTIVE_NAMES`: that vocabulary already has one named source, in this\n * package, and `@wildo-ai/saas-models` — where the footprint has to live,\n * because it rides on the wire — depends on nothing of ours.\n *\n * Total over the footprint's buckets: adding a bucket without deciding its\n * directive is a compile error here, which is the coupling this shape exists\n * for. A bucket with no mapping would be authored, serialized, read, and\n * silently contribute nothing — in production only, since CSP is report-only\n * in development.\n */\nconst PROVIDER_CSP_BUCKET_DIRECTIVES: Readonly<\n Record<ProviderFrontendCspOriginBucket, CspDirectiveName>\n> = {\n [ProviderFrontendCspOriginBucket.SCRIPT]: 'script-src',\n [ProviderFrontendCspOriginBucket.CONNECT]: 'connect-src',\n [ProviderFrontendCspOriginBucket.FRAME]: 'frame-src',\n [ProviderFrontendCspOriginBucket.IMG]: 'img-src',\n [ProviderFrontendCspOriginBucket.STYLE]: 'style-src',\n [ProviderFrontendCspOriginBucket.FONT]: 'font-src',\n};\n\nexport interface ResolveCspPolicyInput {\n readonly frontendType: AppFrontendType;\n readonly appCsp: WildoCspConfig | undefined;\n readonly envOverride?: EnvCspOverride;\n /**\n * The CSP footprints of the providers DECLARED for this service — the fourth\n * layer, added by #332.\n *\n * Without it, a marketing site that wants an embedded meeting or a SaaS app\n * that wants a Drive picker means hand-editing script / frame / connect\n * origins per application, per service, per environment; and getting it wrong\n * is invisible until production, because development is report-only. The\n * caller reads these from the service's materialized provider block, which is\n * DATA precisely so that no frontend module has to be executed to obtain them.\n *\n * Providers declared for ANOTHER service must not appear here: the point of\n * the layer is that a Zoom origin admitted for the marketing site is not\n * thereby admitted for the SaaS app.\n *\n * A footprint's `derivedOrigins` must ALREADY BE RESOLVED into its buckets by\n * the caller. This resolver sees no `publicConfig` — it composes a policy, it\n * does not read a provider's configuration — and the one caller that has both\n * halves is `CspSyncService`, which reads each entry out of the materialized\n * block.\n */\n readonly providerCspFootprints?: ReadonlyArray<ProviderFrontendCspFootprint>;\n /**\n * Environment id this CSP is being resolved for (e.g. `'local'`,\n * `'staging'`, `'production'`, or any custom slug). Optional for\n * back-compat — when `undefined`, no env-aware auto-loosening applies\n * (the resolver behaves exactly as it did pre-`viteDevLoosening`).\n *\n * Required when the caller wants the framework to auto-apply\n * `viteDevLoosening` for `'local'` + `SAAS_APP`. The CLI's\n * `CspSyncService` already knows the env id and SHOULD pass it.\n */\n readonly environmentId?: string;\n}\n\nexport const NGINX_CSP_BEGIN_MARKER = '# >>> wildo csp begin';\nexport const NGINX_CSP_END_MARKER = '# <<< wildo csp end';\n\nconst META_INVALID_DIRECTIVES: ReadonlySet<string> = new Set([\n 'frame-ancestors',\n 'report-uri',\n 'report-to',\n 'sandbox',\n]);\n\n/**\n * Derives the WebSocket-scheme companion origins for every HTTP(S) origin\n * present in a `connect-src` source list, and returns the list widened to\n * include them.\n *\n * Why the framework ships this rather than making each app author it:\n * every Wildo backend serves its realtime channel (Socket.IO) on the SAME\n * origin as its HTTP API. Socket.IO opens the handshake over polling and\n * then UPGRADES to a raw `ws://` / `wss://` connection to that origin. The\n * CSP `connect-src` directive grades WebSocket connections by their `ws`/\n * `wss` scheme, and — per the CSP spec — an `http://host` source does NOT\n * authorize a `ws://host` connection (the schemes are distinct match\n * tokens). So an app that allow-lists `http://localhost:4241` for `fetch`/\n * `XHR` but not `ws://localhost:4241` will emit a `connect-src` violation\n * the instant the socket upgrades — exactly the trap every infra config\n * would otherwise have to remember to work around by hand.\n *\n * Transform (idempotent, dedupe-safe):\n * `http://host[:port]` → also allow `ws://host[:port]`\n * `https://host[:port]` → also allow `wss://host[:port]`\n * bare scheme `http:` → also allow `ws:`\n * bare scheme `https:` → also allow `wss:`\n *\n * Keyword / non-HTTP sources (`'self'`, `'none'`, `data:`, `blob:`, an\n * already-`ws://` origin, …) are passed through untouched. `'self'` is\n * deliberately NOT expanded: the browser tab is served from the frontend\n * origin, never the backend API origin, so a same-origin `ws` derivation\n * from `'self'` would authorize the wrong host. The backend origin is\n * always listed explicitly, which is what this widens.\n */\nfunction augmentConnectSrcWithWebSocketOrigins(\n sources: readonly string[] | undefined,\n): readonly string[] | undefined {\n if (!sources || sources.length === 0) {\n return sources;\n }\n\n const derived: string[] = [];\n for (const source of sources) {\n if (source.startsWith('https://')) {\n derived.push(`wss://${source.slice('https://'.length)}`);\n } else if (source.startsWith('http://')) {\n derived.push(`ws://${source.slice('http://'.length)}`);\n } else if (source === 'https:') {\n derived.push('wss:');\n } else if (source === 'http:') {\n derived.push('ws:');\n }\n }\n\n return mergeSourceLists(sources, derived);\n}\n\nfunction mergeSourceLists(\n a: readonly string[] | undefined,\n b: readonly string[] | undefined,\n): readonly string[] {\n if (!a || a.length === 0) {\n return b ?? [];\n }\n if (!b || b.length === 0) {\n return a;\n }\n\n const seen = new Set(a);\n const out: string[] = [...a];\n for (const source of b) {\n if (!seen.has(source)) {\n seen.add(source);\n out.push(source);\n }\n }\n return out;\n}\n\n/**\n * Resolves the generic layered CSP model shared by all frontend surfaces:\n * platform baseline, app-static config, env-selected overrides, then the\n * declared providers' own footprints (#332).\n *\n * The provider layer is fourth on purpose. The first three describe what the\n * APPLICATION decided; the fourth describes what the things the application\n * declared actually need in order to work. Placing it last means a provider\n * cannot be silently dropped by an app-level `REPLACE_BASELINE`, and placing it\n * before the WebSocket derivation means a provider's `connect-src` origin gets\n * its `wss://` companion exactly like the backend API's.\n *\n * This lives with the CSP schemas/defaults so consumers do not depend on any\n * concrete frontend package to process security config.\n */\nexport function resolveCspPolicy(\n input: ResolveCspPolicyInput,\n): ResolvedCspPolicy | null {\n const { frontendType, appCsp, envOverride } = input;\n\n if (!appCsp || !appCsp.enabled) {\n return null;\n }\n\n const baseline: CspBaselineDirectiveMap = CSP_BASELINES[frontendType];\n let merged: ResolvedCspDirectiveMap;\n\n if (appCsp.mergeStrategy === CspMergeStrategy.REPLACE_BASELINE) {\n merged = appCsp.directives;\n } else {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n const allKeys = new Set<CspDirectiveName>([\n ...(Object.keys(baseline) as CspDirectiveName[]),\n ...(Object.keys(appCsp.directives) as CspDirectiveName[]),\n ]);\n\n for (const key of allKeys) {\n out[key] = mergeSourceLists(baseline[key], appCsp.directives[key]);\n }\n\n merged = out;\n }\n\n if (envOverride?.extraDirectives) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {\n ...merged,\n };\n\n for (const key of Object.keys(envOverride.extraDirectives) as CspDirectiveName[]) {\n out[key] = mergeSourceLists(merged[key], envOverride.extraDirectives[key]);\n }\n\n merged = out;\n }\n\n // Provider layer (#332) — the origins the providers DECLARED FOR THIS SERVICE\n // need, merged after the app-static and env layers and before the WebSocket\n // derivation below (so a provider's `connect-src` origin gets its `wss://`\n // companion for free, exactly like the backend API's).\n //\n // Additive in every merge strategy, including REPLACE_BASELINE. That strategy\n // exists so an app can discard the platform BASELINE when it is wrong for the\n // surface; a provider the same app declared is a dependency it chose, not a\n // default it is overriding, and silently dropping its origins would produce a\n // policy that blocks a feature the app asked for — in production only.\n const providerFootprints = input.providerCspFootprints ?? [];\n if (providerFootprints.length > 0) {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = { ...merged };\n\n for (const footprint of providerFootprints) {\n for (const [bucket, directive] of Object.entries(PROVIDER_CSP_BUCKET_DIRECTIVES) as ReadonlyArray<\n readonly [ProviderFrontendCspOriginBucket, CspDirectiveName]\n >) {\n const origins = footprint[bucket];\n if (origins.length === 0) continue;\n out[directive] = mergeSourceLists(out[directive], origins);\n }\n }\n\n merged = out;\n }\n\n // Vite dev-mode loosening (auto-applied for local SAAS_APP).\n //\n // Vite's dev server REQUIRES both `'unsafe-eval'` (lazy module +\n // sourcemap transforms) and `'unsafe-inline'` (HMR client bootstrap\n // injects a literal inline `<script>`) to function. Under the tight\n // SAAS_APP baseline (`script-src 'self'`), those produce ~120+ CSP\n // violations per page load that drown out real signal (e.g. the\n // Google-Fonts gotcha that the loosened style-src/font-src now allow).\n //\n // The framework SHIPS this knowledge — every Wildo SaaS app uses\n // Vite — so we auto-loosen for `'local'` + `SAAS_APP` here rather\n // than forcing every infra config to re-author the same opt-in. An\n // explicit `viteDevLoosening: false` override keeps tight `script-src`\n // when an author is actively debugging a real CSP issue and willing\n // to accept the Vite noise. Production builds emit `<script\n // type=\"module\">` only and never `eval()`, so production envs never\n // trigger the auto-loosening — `viteDevLoosening` defaults to FALSE\n // there even if the env id is non-`local`.\n const isViteDevAutoTarget =\n input.environmentId === WildoEnvironment.LOCAL &&\n frontendType === AppFrontendType.SAAS_APP;\n const viteDevLoosening = envOverride?.viteDevLoosening ?? isViteDevAutoTarget;\n if (viteDevLoosening) {\n merged = {\n ...merged,\n 'script-src': mergeSourceLists(\n merged['script-src'],\n [\"'unsafe-inline'\", \"'unsafe-eval'\"],\n ),\n };\n }\n\n // Auto-derive the `ws://` / `wss://` companion origins for every HTTP(S)\n // origin the app allow-listed in `connect-src`. Applied LAST so it covers\n // origins contributed by the baseline, app-static config, AND env override\n // alike (e.g. the local `http://localhost:4241` and the staging/prod\n // `https://api.<app>.wildo.app` backend origins). Without this, the\n // Socket.IO transport upgrade to a raw WebSocket against the backend origin\n // trips a `connect-src` violation on every surface. See the helper JSDoc for\n // the scheme-matching rationale.\n const connectSrcWithWs = augmentConnectSrcWithWebSocketOrigins(merged['connect-src']);\n if (connectSrcWithWs !== merged['connect-src']) {\n merged = {\n ...merged,\n 'connect-src': connectSrcWithWs,\n };\n }\n\n return {\n directives: merged,\n reportOnly: envOverride?.reportOnly ?? appCsp.reportOnly,\n reportUri: envOverride?.reportUri ?? appCsp.reportUri,\n };\n}\n\nfunction serializeDirectives(directives: ResolvedCspDirectiveMap): string {\n return Object.entries(directives)\n .filter(([, sources]) => sources && sources.length > 0)\n .map(([name, sources]) => `${name} ${(sources ?? []).join(' ')}`)\n .join('; ');\n}\n\nfunction stripMetaInvalidDirectives(\n directives: ResolvedCspDirectiveMap,\n): ResolvedCspDirectiveMap {\n const out: Partial<Record<CspDirectiveName, readonly string[]>> = {};\n\n for (const [name, sources] of Object.entries(directives)) {\n if (!META_INVALID_DIRECTIVES.has(name)) {\n out[name as CspDirectiveName] = sources;\n }\n }\n\n return out;\n}\n\nfunction withReportUri(\n directives: ResolvedCspDirectiveMap,\n reportUri: string | undefined,\n): ResolvedCspDirectiveMap {\n if (!reportUri) {\n return directives;\n }\n\n return {\n ...directives,\n ['report-uri' as CspDirectiveName]: [reportUri],\n };\n}\n\nexport function emitCspArtifacts(policy: ResolvedCspPolicy): CspEmitArtifacts {\n const nginxHeaderName = policy.reportOnly\n ? 'Content-Security-Policy-Report-Only'\n : 'Content-Security-Policy';\n const nginxPolicyValue = serializeDirectives(\n withReportUri(policy.directives, policy.reportUri),\n );\n\n return {\n nginxHeaderName,\n nginxPolicyValue,\n nginxAddHeaderLine: `add_header ${nginxHeaderName} \"${nginxPolicyValue}\" always;`,\n metaTag: policy.reportOnly\n ? null\n : {\n tagName: 'meta',\n attributes: {\n 'http-equiv': 'Content-Security-Policy',\n content: serializeDirectives(stripMetaInvalidDirectives(policy.directives)),\n },\n },\n };\n}\n\n/**\n * A single static-host `_headers` block that delivers the resolved CSP as a\n * real response header at the `/*` (all-paths) scope.\n *\n * Format matches the `_headers` convention consumed by Cloudflare Pages /\n * Netlify / Vercel (and the `saas-website` `X-Robots-Tag` `_headers` emitter):\n * a path line, then two-space-indented `Header-Name: value` lines. This is the\n * PORTABLE, provider-agnostic edge-CSP delivery — a CDN-served frontend (which\n * has no nginx to `add_header`) ships this file in its bucket and any\n * `_headers`-aware host applies it.\n *\n * Uses the FULL header value (including the header-only `frame-ancestors` and\n * `report-uri` directives) — a `_headers` line is a genuine response header, so\n * nothing is stripped (unlike the `<meta http-equiv>` fallback). Report-only\n * policies are honoured (the header name flips to\n * `Content-Security-Policy-Report-Only`, valid on a real header channel).\n *\n * The caller composes this block with any other `_headers` blocks (e.g. the\n * website's per-path `X-Robots-Tag`) into one file, separated by a blank line.\n */\nexport function emitCspHeadersFileBlock(policy: ResolvedCspPolicy): string {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return `/*\\n ${nginxHeaderName}: ${nginxPolicyValue}`;\n}\n\n/**\n * Provider-agnostic descriptor of the response-header MODIFICATION a CDN vendor\n * must install to deliver the resolved CSP at the edge. A concrete vendor\n * adapter (e.g. Cloudflare) maps this to its own API shape — for Cloudflare, a\n * `http_response_headers_transform` ruleset rule whose action sets\n * `headerName` to `value`.\n *\n * Same FULL header name + value as the nginx / `_headers` channels (a CDN sets\n * a real header, so `frame-ancestors` / `report-uri` are valid and retained).\n */\nexport interface CspEdgeHeaderModification {\n /** Cloudflare ruleset phase this modification belongs to. */\n readonly phase: 'http_response_headers_transform';\n /** The header operation — always `set` (overwrite any origin value). */\n readonly operation: 'set';\n /** Response-header name (report-only-aware, same as the nginx channel). */\n readonly headerName: string;\n /** Serialized policy value (identical to `nginxPolicyValue`). */\n readonly value: string;\n}\n\n/**\n * Derive the edge response-header modification carrying the resolved CSP, for a\n * CDN vendor's live-provisioning adapter to install. Thin over\n * {@link emitCspArtifacts} so the directive serialization is the single source\n * of truth across nginx / `_headers` / CDN channels.\n */\nexport function emitCspEdgeHeaderModification(policy: ResolvedCspPolicy): CspEdgeHeaderModification {\n const { nginxHeaderName, nginxPolicyValue } = emitCspArtifacts(policy);\n return {\n phase: 'http_response_headers_transform',\n operation: 'set',\n headerName: nginxHeaderName,\n value: nginxPolicyValue,\n };\n}\n\nexport interface RewriteNginxResult {\n readonly totalPairs: number;\n readonly pairsRewritten: number;\n readonly fileWritten: boolean;\n}\n\nexport function rewriteNginxCspMarkerPairs(\n filePath: string,\n addHeaderLine: string,\n): RewriteNginxResult {\n const original = readFileSync(filePath, 'utf-8');\n const { rewritten, totalPairs, pairsChanged } = rewriteNginxCspMarkerPairsString(\n original,\n addHeaderLine,\n filePath,\n );\n const fileWritten = rewritten !== original;\n\n if (fileWritten) {\n writeFileSync(filePath, rewritten, 'utf-8');\n }\n\n return {\n totalPairs,\n pairsRewritten: pairsChanged,\n fileWritten,\n };\n}\n\nexport function rewriteNginxCspMarkerPairsString(\n source: string,\n addHeaderLine: string,\n filePath = '<in-memory>',\n): {\n readonly rewritten: string;\n readonly totalPairs: number;\n readonly pairsChanged: number;\n} {\n const usesCrlf = source.includes('\\r\\n');\n const newline = usesCrlf ? '\\r\\n' : '\\n';\n const lines = source.split(newline);\n\n let totalPairs = 0;\n let pairsChanged = 0;\n let openBeginIndex: number | null = null;\n let openIndent = '';\n\n for (let index = 0; index < lines.length; index += 1) {\n const trimmed = lines[index].trim();\n\n if (trimmed === NGINX_CSP_BEGIN_MARKER) {\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found a second '${NGINX_CSP_BEGIN_MARKER}' before the previous '${NGINX_CSP_END_MARKER}' (line ${openBeginIndex + 1})`,\n );\n }\n\n openBeginIndex = index;\n openIndent = lines[index].slice(0, lines[index].indexOf('#'));\n continue;\n }\n\n if (trimmed === NGINX_CSP_END_MARKER) {\n if (openBeginIndex === null) {\n throw new Error(\n `[csp-emit] ${filePath}:${index + 1} found '${NGINX_CSP_END_MARKER}' without a matching '${NGINX_CSP_BEGIN_MARKER}'`,\n );\n }\n\n totalPairs += 1;\n\n const existingBody = lines.slice(openBeginIndex + 1, index);\n const canonicalBody = [`${openIndent}${addHeaderLine}`];\n const existingNonBlank = existingBody.filter((line) => line.trim().length > 0);\n const canonicalNonBlank = canonicalBody.filter((line) => line.trim().length > 0);\n const bodyMatches =\n existingNonBlank.length === canonicalNonBlank.length &&\n existingNonBlank.every((line, bodyIndex) => line === canonicalNonBlank[bodyIndex]);\n\n if (!bodyMatches) {\n lines.splice(openBeginIndex + 1, index - openBeginIndex - 1, ...canonicalBody);\n index = openBeginIndex + canonicalBody.length + 1;\n pairsChanged += 1;\n }\n\n openBeginIndex = null;\n openIndent = '';\n }\n }\n\n if (openBeginIndex !== null) {\n throw new Error(\n `[csp-emit] ${filePath} has an unclosed '${NGINX_CSP_BEGIN_MARKER}' starting at line ${openBeginIndex + 1}`,\n );\n }\n\n return { rewritten: lines.join(newline), totalPairs, pairsChanged };\n}\n"]}
@@ -149,11 +149,11 @@ export type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;
149
149
  *
150
150
  * Declaring a Content-Security-Policy for one of the application's frontends.
151
151
  *
152
- * ⚠️ **It is OPT-IN, and omitting the block emits NO policy on either channel.** `enabled: false` and
153
- * an absent block are the same thing: no header, no protection. That default is deliberate — a
154
- * frontend that has not audited its third-party script and fetch surface should not ship a half-baked
155
- * policy that breaks features without protecting anything — but it does mean an application acquires
156
- * no CSP by existing.
152
+ * ⚠️ **Every browser surface ships a policy; what differs is what happens when you author none.** On
153
+ * the application (`services.<key>.csp`) an omitted block resolves at sync to `enabled: true,
154
+ * reportOnly: true` — a policy that reports violations and blocks nothing. A website or technical-doc
155
+ * config with no block is refused at sync, naming the file. A policy that resolves DISABLED is refused
156
+ * on every surface, so `enabled: false` cannot switch the header off.
157
157
  *
158
158
  * ## The generated file is the only one read
159
159
  *
@@ -178,10 +178,8 @@ export type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;
178
178
  * `wildo.website.config.ts.csp?`, and `services.<key>.csp` on the
179
179
  * `SAAS_APP` service definition.
180
180
  *
181
- * Opt-in by default: `enabled: false` (or omitting the block entirely)
182
- * emits NO policy on either channel. Frontends that have not audited
183
- * their third-party JS / fetch surface should not ship a half-baked
184
- * CSP that breaks features without protecting anything.
181
+ * An AUTHORED block that omits `enabled` parses as `enabled: false`, which the resolver turns into no
182
+ * policy and the sync then refuses — so author `enabled: true` explicitly whenever you write a block.
185
183
  *
186
184
  * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`
187
185
  * (no `d`) or `directive: { … }` (no plural) MUST surface as parse
@@ -191,9 +189,10 @@ export type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;
191
189
  */
192
190
  export declare const WildoCspConfigSchema: z.ZodObject<{
193
191
  /**
194
- * Opt-in switch. `false` (default) => no policy emitted; the
195
- * resolver returns `null`. `true` => baseline (+ overrides) emitted
196
- * on both channels per `reportOnly`.
192
+ * `true` => baseline (+ overrides) emitted on both channels per `reportOnly`.
193
+ * `false` — also the parse default for an authored block — makes the resolver return `null`, and
194
+ * `wildo dev sync-csp` refuses that for every CSP-capable surface. It is not a way to turn the
195
+ * header off.
197
196
  */
198
197
  enabled: z.ZodDefault<z.ZodBoolean>;
199
198
  /**