@wildo-ai/platform-config-lib 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.js +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -1
- package/dist/esm/blueprint/anchored-region.d.ts +83 -0
- package/dist/esm/blueprint/anchored-region.d.ts.map +1 -0
- package/dist/esm/blueprint/anchored-region.js +263 -0
- package/dist/esm/blueprint/anchored-region.js.map +1 -0
- package/dist/esm/blueprint/blueprint.schemas.d.ts +689 -0
- package/dist/esm/blueprint/blueprint.schemas.d.ts.map +1 -0
- package/dist/esm/blueprint/blueprint.schemas.js +638 -0
- package/dist/esm/blueprint/blueprint.schemas.js.map +1 -0
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +13 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +6 -0
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +21 -3
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +14 -3
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +121 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +129 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-response-integrity.d.ts +249 -0
- package/dist/esm/bootstrap/runtime-response-integrity.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-response-integrity.js +353 -0
- package/dist/esm/bootstrap/runtime-response-integrity.js.map +1 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts +32 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.js +43 -0
- package/dist/esm/bootstrap/runtime-secret-env.contracts.js.map +1 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts +51 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.d.ts.map +1 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.js +231 -0
- package/dist/esm/canonical-json/rfc8785-canonical-json.js.map +1 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/key-management/approval-seal-verifier.d.ts +216 -0
- package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -0
- package/dist/esm/key-management/approval-seal-verifier.js +233 -0
- package/dist/esm/key-management/approval-seal-verifier.js.map +1 -0
- package/dist/esm/key-management/approval-seal.contracts.d.ts +131 -0
- package/dist/esm/key-management/approval-seal.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/approval-seal.contracts.js +115 -0
- package/dist/esm/key-management/approval-seal.contracts.js.map +1 -0
- package/dist/esm/key-management/data-key.contracts.d.ts +108 -0
- package/dist/esm/key-management/data-key.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/data-key.contracts.js +54 -0
- package/dist/esm/key-management/data-key.contracts.js.map +1 -0
- package/dist/esm/key-management/es256-jws.d.ts +60 -0
- package/dist/esm/key-management/es256-jws.d.ts.map +1 -0
- package/dist/esm/key-management/es256-jws.js +135 -0
- package/dist/esm/key-management/es256-jws.js.map +1 -0
- package/dist/esm/key-management/key-provider.spi.d.ts +151 -0
- package/dist/esm/key-management/key-provider.spi.d.ts.map +1 -0
- package/dist/esm/key-management/key-provider.spi.js +38 -0
- package/dist/esm/key-management/key-provider.spi.js.map +1 -0
- package/dist/esm/key-management/keyring-rotation.contracts.d.ts +93 -0
- package/dist/esm/key-management/keyring-rotation.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/keyring-rotation.contracts.js +101 -0
- package/dist/esm/key-management/keyring-rotation.contracts.js.map +1 -0
- package/dist/esm/key-management/keyring-status.contracts.d.ts +66 -0
- package/dist/esm/key-management/keyring-status.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/keyring-status.contracts.js +45 -0
- package/dist/esm/key-management/keyring-status.contracts.js.map +1 -0
- package/dist/esm/key-management/signature-request.contracts.d.ts +95 -0
- package/dist/esm/key-management/signature-request.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/signature-request.contracts.js +96 -0
- package/dist/esm/key-management/signature-request.contracts.js.map +1 -0
- package/dist/esm/key-management/signing-log-export.contracts.d.ts +216 -0
- package/dist/esm/key-management/signing-log-export.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/signing-log-export.contracts.js +268 -0
- package/dist/esm/key-management/signing-log-export.contracts.js.map +1 -0
- package/dist/esm/key-management/vault-custody.contracts.d.ts +55 -0
- package/dist/esm/key-management/vault-custody.contracts.d.ts.map +1 -0
- package/dist/esm/key-management/vault-custody.contracts.js +88 -0
- package/dist/esm/key-management/vault-custody.contracts.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts +7 -9
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +23 -22
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +17 -14
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +9 -9
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +26 -2
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -2
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js +9 -2
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
- package/dist/esm/project-config/application-served-public-documents.loader.d.ts +26 -0
- package/dist/esm/project-config/application-served-public-documents.loader.d.ts.map +1 -0
- package/dist/esm/project-config/application-served-public-documents.loader.js +78 -0
- package/dist/esm/project-config/application-served-public-documents.loader.js.map +1 -0
- package/dist/esm/project-config/define-infra-env-config.d.ts +236 -15
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +104 -91
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +133 -3
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +170 -19
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.js +3 -0
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts +3 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +3 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
- package/dist/esm/project-config/npm-version-range.js +39 -16
- package/dist/esm/project-config/npm-version-range.js.map +1 -1
- package/dist/esm/project-config/owning-package-tsconfig.d.ts +15 -0
- package/dist/esm/project-config/owning-package-tsconfig.d.ts.map +1 -0
- package/dist/esm/project-config/owning-package-tsconfig.js +29 -0
- package/dist/esm/project-config/owning-package-tsconfig.js.map +1 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts +4 -4
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +13 -9
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +32 -3
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +67 -13
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts +4 -5
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.js +4 -5
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts +1 -2
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js +1 -2
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +6 -0
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +8 -1
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +1 -0
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +3 -0
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +4 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +6 -2
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +250 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.js +194 -0
- package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -0
- package/dist/esm/registry/index.d.ts +1 -0
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js +1 -0
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts +22 -2
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
- package/dist/esm/registry/local-checkout-source.js +66 -3
- package/dist/esm/registry/local-checkout-source.js.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +10 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts +23 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +336 -18
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +245 -19
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts +2 -0
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-search.schemas.js +14 -1
- package/dist/esm/registry/module-search.schemas.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts +22 -2
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js +28 -2
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +5 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-url-resolution.d.ts +72 -0
- package/dist/esm/registry/registry-url-resolution.d.ts.map +1 -0
- package/dist/esm/registry/registry-url-resolution.js +157 -0
- package/dist/esm/registry/registry-url-resolution.js.map +1 -0
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +55 -0
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +53 -0
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-`AppFrontendType` Content-Security-Policy baselines (
|
|
3
|
-
*
|
|
2
|
+
* Per-`AppFrontendType` Content-Security-Policy baselines (auth-hardening
|
|
3
|
+
* Slice B, B-Step 1).
|
|
4
4
|
*
|
|
5
5
|
* # Why one baseline per frontend kind (vs a single platform-wide one)
|
|
6
6
|
*
|
|
@@ -64,9 +64,8 @@
|
|
|
64
64
|
*
|
|
65
65
|
* # `report-uri` is intentionally NOT in any baseline
|
|
66
66
|
*
|
|
67
|
-
* The platform doesn't ship a CSP-violation collector yet
|
|
68
|
-
*
|
|
69
|
-
* endpoint" tracks that as an independent follow-up). Authoring a
|
|
67
|
+
* The platform doesn't ship a CSP-violation collector yet (#2867 tracks
|
|
68
|
+
* it). Authoring a
|
|
70
69
|
* baseline `report-uri` value would be a config lie; per-app authoring
|
|
71
70
|
* via the `WildoCspConfigSchema.reportUri` field is the right seam
|
|
72
71
|
* once a real collector exists.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp-defaults.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-defaults.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"csp-defaults.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-`AppFrontendType` Content-Security-Policy baselines (
|
|
3
|
-
*
|
|
2
|
+
* Per-`AppFrontendType` Content-Security-Policy baselines (auth-hardening
|
|
3
|
+
* Slice B, B-Step 1).
|
|
4
4
|
*
|
|
5
5
|
* # Why one baseline per frontend kind (vs a single platform-wide one)
|
|
6
6
|
*
|
|
@@ -64,9 +64,8 @@
|
|
|
64
64
|
*
|
|
65
65
|
* # `report-uri` is intentionally NOT in any baseline
|
|
66
66
|
*
|
|
67
|
-
* The platform doesn't ship a CSP-violation collector yet
|
|
68
|
-
*
|
|
69
|
-
* endpoint" tracks that as an independent follow-up). Authoring a
|
|
67
|
+
* The platform doesn't ship a CSP-violation collector yet (#2867 tracks
|
|
68
|
+
* it). Authoring a
|
|
70
69
|
* baseline `report-uri` value would be a config lie; per-app authoring
|
|
71
70
|
* via the `WildoCspConfigSchema.reportUri` field is the right seam
|
|
72
71
|
* once a real collector exists.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp-defaults.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAavE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,iBAAiB,GAA4B;IACjD,aAAa,EAAE,CAAC,QAAQ,CAAC;IACzB,YAAY,EAAE,CAAC,QAAQ,CAAC;IACxB,WAAW,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,8BA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AAY,EAAE,CAAC,QAAQ,CAAC;IACxB,aAAa,EAAE,CAAC,QAAQ,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,CAAC;CACvB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,iBAAiB;IAC7C,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,uBAAuB;IACzD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,iBAAiB;CAC9C,CAAC","sourcesContent":["/**\n * Per-`AppFrontendType` Content-Security-Policy baselines (Slice B B-Step 1\n * — `auth-hardening.md`).\n *\n * # Why one baseline per frontend kind (vs a single platform-wide one)\n *\n * The three `AppFrontendType` kinds (`SAAS_APP` / `STATIC_WEBSITE` /\n * `TECH_DOC`) genuinely have different inline-script / inline-style\n * pressure:\n *\n * - `SAAS_APP` — React SPA built with Vite. Vite's production output\n * uses ESM `<script type=\"module\">` with no inline scripts, AND\n * the runtime emits no inline styles. So the `SAAS_APP` baseline\n * is the tightest of the three: NO `'unsafe-inline'` for scripts,\n * `'unsafe-inline'` for styles ONLY because Tailwind's runtime\n * style-injection (e.g., `@apply` with arbitrary values) emits\n * short-lived inline `<style>` tags.\n * - `TECH_DOC` — Docusaurus 3.x SSG. Its hydration shim and classic-theme\n * bootstrap inject inline `<script>` (theme detection, color-mode\n * restoration and route-state seed), while generated/theme markup uses\n * inline styles. So the `TECH_DOC` baseline MUST allow `'unsafe-inline'`\n * for both scripts AND styles. Tightening\n * to nonce-based `'self'` only is a post-Slice-B follow-up that\n * would require an upstream Docusaurus runtime change OR a\n * nonce-injecting build plugin.\n * - `STATIC_WEBSITE` — Astro SSG marketing site. The marketing\n * surface typically embeds analytics / advertising / chat-widget\n * pixels (each a third-party origin), so the baseline ships an\n * intentionally-empty `script-src` / `connect-src` extension list\n * (just `'self'`) and forces the per-app config to opt into every\n * third-party origin explicitly. Per-app `directives['script-src']`\n * overrides MUST list the third-party hostnames the marketing team\n * has actually whitelisted (no implicit `'unsafe-inline'`).\n *\n * A single platform-wide baseline would force the lowest common\n * denominator (`TECH_DOC`'s `'unsafe-inline'` for everyone) and lose\n * the SAAS_APP tightness for no gain.\n *\n * # Shared posture across all three baselines\n *\n * - `default-src 'self'` — block by default; everything else opts\n * in explicitly via specific directives.\n * - `frame-ancestors 'none'` — refuse iframe embedding. Header-only\n * directive (meta channel ignores it; the `csp-emit.ts` serializer\n * strips it from the meta tag automatically).\n * - `object-src 'none'` — block `<object>` / `<embed>` plugin loading\n * entirely. None of the three frontend kinds have a use case for\n * legacy plugins.\n * - `form-action 'self'` — block `<form action=\"…\">` from POSTing\n * to a third-party origin. Closes the cross-origin form-injection\n * surface even when the rest of the policy is permissive.\n * - `base-uri 'self'` — block `<base href=\"…\">` injection from\n * redirecting relative URLs to an attacker-controlled origin.\n *\n * # Connect-src\n *\n * Every baseline ships `connect-src 'self'` — the resolver merges in\n * additional origins via the app-static `directives['connect-src']`\n * override (e.g., the SaaS backend API hostname), and via Slice B\n * Step 2's env-layer override for per-env additions (Sentry, analytics\n * collectors). The baseline does NOT include any backend hostname\n * because the resolver does NOT know the deployment env at the engine\n * layer; per-env hostnames are an env-config concern.\n *\n * # `report-uri` is intentionally NOT in any baseline\n *\n * The platform doesn't ship a CSP-violation collector yet\n * (`auth-hardening.md` \"Cheap Bonuses — CSP violation monitoring\n * endpoint\" tracks that as an independent follow-up). Authoring a\n * baseline `report-uri` value would be a config lie; per-app authoring\n * via the `WildoCspConfigSchema.reportUri` field is the right seam\n * once a real collector exists.\n */\n\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type { CspDirectiveName } from './csp.schemas';\n\n/**\n * Baseline directive map for one `AppFrontendType`. Internal shape — the\n * resolver in `platform-config-lib/src/project-config/shared/csp-emit.ts` produces\n * the same shape as its post-merge output. Distinct from the AUTHOR-side\n * `WildoCspConfig.directives` (which is partial; this is total).\n */\nexport type CspBaselineDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\n/**\n * `SAAS_APP` baseline — tightest of the three. Vite-bundled React SPA\n * with no inline scripts (production builds emit `<script type=\"module\">`).\n * `style-src 'unsafe-inline'` covers Tailwind runtime style injection.\n *\n * # Google Fonts origins in `style-src` and `font-src`\n *\n * The design-token system (`saas-frontend-lib/src/core/ui/design-token.utils.ts`)\n * ships `applyGoogleFontPreset()` as the canonical web-font loader for\n * `SAAS_APP` shells. It builds a `https://fonts.googleapis.com/css2?...`\n * `<link rel=\"stylesheet\">` at runtime, which in turn pulls woff2 files\n * from `https://fonts.gstatic.com/...`. Both origins MUST be in the\n * baseline because:\n *\n * 1. The font loader is framework-shipped, not app-authored. An app\n * developer that simply uses an `OKLCH` design-token preset with a\n * Google Font family inherits the loader without writing any code,\n * and would hit CSP blocks on every shell render in production\n * (today they're masked because `reportOnly: true` is the typical\n * dev posture).\n * 2. Widening to two specific origins is dramatically safer than the\n * alternatives — `'unsafe-inline'` (which we already accept for\n * Tailwind) is orders of magnitude broader; nonces are not\n * compatible with a runtime-injected `<link>` that doesn't carry\n * our nonce attribute.\n * 3. Apps that prefer fully-local fonts (e.g., self-hosted woff2 in\n * `public/fonts/`) and never call `applyGoogleFontPreset()` can\n * tighten back via the per-app `directives['style-src']` /\n * `directives['font-src']` override — the resolver merges as a\n * union, so the per-app config can restate `[\"'self'\", \"'unsafe-inline'\"]`\n * without `fonts.googleapis.com` and CSP will warn (or block) any\n * stray Google-Fonts call.\n *\n * `preconnect` to both origins happens at the same site\n * (`design-token.utils.ts` lines 982–996). Preconnect is governed by\n * `connect-src`, not `style-src` / `font-src`, BUT modern browsers\n * treat `<link rel=\"preconnect\">` as a hint that doesn't require CSP\n * fetch directives — the actual fetch later in the pipeline carries\n * the resource type and is what CSP grades. No `connect-src` widening\n * is needed.\n */\nconst SAAS_APP_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\", 'https://fonts.googleapis.com'],\n 'img-src': [\"'self'\", 'data:', 'blob:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\", 'data:', 'https://fonts.gstatic.com'],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * `TECH_DOC` baseline — Docusaurus 3.x SSG. `'unsafe-inline'` on both\n * `script-src` AND `style-src` is required by the Docusaurus runtime\n * (classic-theme bootstrap and hydration shim). `img-src` retains `data:` and\n * `blob:` because the documentation product supports generated/MDX images\n * expressed with those browser-native URL schemes. Fonts are self-hosted; the\n * removed OpenAPI theme's inline icon-font allowance is deliberately gone.\n *\n * Tightening to nonce-based `'self'` only is a post-Slice-B follow-up\n * (would require an upstream Docusaurus runtime change OR a\n * nonce-injecting build plugin — out of scope today).\n */\nconst TECH_DOC_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\", \"'unsafe-inline'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\"],\n 'img-src': [\"'self'\", 'data:', 'blob:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\"],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * `STATIC_WEBSITE` baseline — Astro SSG marketing site. Intentionally\n * narrow `script-src` / `connect-src` to force the per-app config to\n * opt into every third-party hostname (analytics, advertising, chat\n * widget) explicitly. NO implicit `'unsafe-inline'` — the marketing\n * team must opt in per origin (or use nonces / hashes once those are\n * wired by the marketing build plugin).\n *\n * `style-src 'unsafe-inline'` is included because Astro's view\n * transitions and inline scoped styles emit short-lived inline\n * `<style>` tags; stripping that would break the marketing animations\n * the website team relies on.\n *\n * `img-src` includes `https:` because marketing pages routinely embed\n * third-party imagery (case-study screenshots, partner logos hosted on\n * a CDN). Tightening to a closed allow-list per app is the per-app\n * `directives['img-src']` override's job.\n */\nconst STATIC_WEBSITE_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\"],\n 'img-src': [\"'self'\", 'data:', 'blob:', 'https:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\", 'data:'],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * Per-`AppFrontendType` baseline registry. Total over the enum — adding\n * a new `AppFrontendType` value forces a baseline edit here at compile\n * time (TS error on the missing key). That coupling is the whole point\n * of the registry shape: a new frontend kind that ships without a CSP\n * baseline would silently get NO policy on any deployment until someone\n * notices.\n */\nexport const CSP_BASELINES: Readonly<\n Record<AppFrontendType, CspBaselineDirectiveMap>\n> = {\n [AppFrontendType.SAAS_APP]: SAAS_APP_BASELINE,\n [AppFrontendType.STATIC_WEBSITE]: STATIC_WEBSITE_BASELINE,\n [AppFrontendType.TECH_DOC]: TECH_DOC_BASELINE,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"csp-defaults.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAavE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,iBAAiB,GAA4B;IACjD,aAAa,EAAE,CAAC,QAAQ,CAAC;IACzB,YAAY,EAAE,CAAC,QAAQ,CAAC;IACxB,WAAW,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,8BAA8B,CAAC;IAC1E,SAAS,EAAE,CAAC,QAAQ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,EAAE,CAAC,QAAQ,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,CAAC;CACvB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,iBAAiB;IAC7C,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,uBAAuB;IACzD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,iBAAiB;CAC9C,CAAC","sourcesContent":["/**\n * Per-`AppFrontendType` Content-Security-Policy baselines (auth-hardening\n * Slice B, B-Step 1).\n *\n * # Why one baseline per frontend kind (vs a single platform-wide one)\n *\n * The three `AppFrontendType` kinds (`SAAS_APP` / `STATIC_WEBSITE` /\n * `TECH_DOC`) genuinely have different inline-script / inline-style\n * pressure:\n *\n * - `SAAS_APP` — React SPA built with Vite. Vite's production output\n * uses ESM `<script type=\"module\">` with no inline scripts, AND\n * the runtime emits no inline styles. So the `SAAS_APP` baseline\n * is the tightest of the three: NO `'unsafe-inline'` for scripts,\n * `'unsafe-inline'` for styles ONLY because Tailwind's runtime\n * style-injection (e.g., `@apply` with arbitrary values) emits\n * short-lived inline `<style>` tags.\n * - `TECH_DOC` — Docusaurus 3.x SSG. Its hydration shim and classic-theme\n * bootstrap inject inline `<script>` (theme detection, color-mode\n * restoration and route-state seed), while generated/theme markup uses\n * inline styles. So the `TECH_DOC` baseline MUST allow `'unsafe-inline'`\n * for both scripts AND styles. Tightening\n * to nonce-based `'self'` only is a post-Slice-B follow-up that\n * would require an upstream Docusaurus runtime change OR a\n * nonce-injecting build plugin.\n * - `STATIC_WEBSITE` — Astro SSG marketing site. The marketing\n * surface typically embeds analytics / advertising / chat-widget\n * pixels (each a third-party origin), so the baseline ships an\n * intentionally-empty `script-src` / `connect-src` extension list\n * (just `'self'`) and forces the per-app config to opt into every\n * third-party origin explicitly. Per-app `directives['script-src']`\n * overrides MUST list the third-party hostnames the marketing team\n * has actually whitelisted (no implicit `'unsafe-inline'`).\n *\n * A single platform-wide baseline would force the lowest common\n * denominator (`TECH_DOC`'s `'unsafe-inline'` for everyone) and lose\n * the SAAS_APP tightness for no gain.\n *\n * # Shared posture across all three baselines\n *\n * - `default-src 'self'` — block by default; everything else opts\n * in explicitly via specific directives.\n * - `frame-ancestors 'none'` — refuse iframe embedding. Header-only\n * directive (meta channel ignores it; the `csp-emit.ts` serializer\n * strips it from the meta tag automatically).\n * - `object-src 'none'` — block `<object>` / `<embed>` plugin loading\n * entirely. None of the three frontend kinds have a use case for\n * legacy plugins.\n * - `form-action 'self'` — block `<form action=\"…\">` from POSTing\n * to a third-party origin. Closes the cross-origin form-injection\n * surface even when the rest of the policy is permissive.\n * - `base-uri 'self'` — block `<base href=\"…\">` injection from\n * redirecting relative URLs to an attacker-controlled origin.\n *\n * # Connect-src\n *\n * Every baseline ships `connect-src 'self'` — the resolver merges in\n * additional origins via the app-static `directives['connect-src']`\n * override (e.g., the SaaS backend API hostname), and via Slice B\n * Step 2's env-layer override for per-env additions (Sentry, analytics\n * collectors). The baseline does NOT include any backend hostname\n * because the resolver does NOT know the deployment env at the engine\n * layer; per-env hostnames are an env-config concern.\n *\n * # `report-uri` is intentionally NOT in any baseline\n *\n * The platform doesn't ship a CSP-violation collector yet (#2867 tracks\n * it). Authoring a\n * baseline `report-uri` value would be a config lie; per-app authoring\n * via the `WildoCspConfigSchema.reportUri` field is the right seam\n * once a real collector exists.\n */\n\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type { CspDirectiveName } from './csp.schemas';\n\n/**\n * Baseline directive map for one `AppFrontendType`. Internal shape — the\n * resolver in `platform-config-lib/src/project-config/shared/csp-emit.ts` produces\n * the same shape as its post-merge output. Distinct from the AUTHOR-side\n * `WildoCspConfig.directives` (which is partial; this is total).\n */\nexport type CspBaselineDirectiveMap = Readonly<\n Partial<Record<CspDirectiveName, readonly string[]>>\n>;\n\n/**\n * `SAAS_APP` baseline — tightest of the three. Vite-bundled React SPA\n * with no inline scripts (production builds emit `<script type=\"module\">`).\n * `style-src 'unsafe-inline'` covers Tailwind runtime style injection.\n *\n * # Google Fonts origins in `style-src` and `font-src`\n *\n * The design-token system (`saas-frontend-lib/src/core/ui/design-token.utils.ts`)\n * ships `applyGoogleFontPreset()` as the canonical web-font loader for\n * `SAAS_APP` shells. It builds a `https://fonts.googleapis.com/css2?...`\n * `<link rel=\"stylesheet\">` at runtime, which in turn pulls woff2 files\n * from `https://fonts.gstatic.com/...`. Both origins MUST be in the\n * baseline because:\n *\n * 1. The font loader is framework-shipped, not app-authored. An app\n * developer that simply uses an `OKLCH` design-token preset with a\n * Google Font family inherits the loader without writing any code,\n * and would hit CSP blocks on every shell render in production\n * (today they're masked because `reportOnly: true` is the typical\n * dev posture).\n * 2. Widening to two specific origins is dramatically safer than the\n * alternatives — `'unsafe-inline'` (which we already accept for\n * Tailwind) is orders of magnitude broader; nonces are not\n * compatible with a runtime-injected `<link>` that doesn't carry\n * our nonce attribute.\n * 3. Apps that prefer fully-local fonts (e.g., self-hosted woff2 in\n * `public/fonts/`) and never call `applyGoogleFontPreset()` can\n * tighten back via the per-app `directives['style-src']` /\n * `directives['font-src']` override — the resolver merges as a\n * union, so the per-app config can restate `[\"'self'\", \"'unsafe-inline'\"]`\n * without `fonts.googleapis.com` and CSP will warn (or block) any\n * stray Google-Fonts call.\n *\n * `preconnect` to both origins happens at the same site\n * (`design-token.utils.ts` lines 982–996). Preconnect is governed by\n * `connect-src`, not `style-src` / `font-src`, BUT modern browsers\n * treat `<link rel=\"preconnect\">` as a hint that doesn't require CSP\n * fetch directives — the actual fetch later in the pipeline carries\n * the resource type and is what CSP grades. No `connect-src` widening\n * is needed.\n */\nconst SAAS_APP_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\", 'https://fonts.googleapis.com'],\n 'img-src': [\"'self'\", 'data:', 'blob:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\", 'data:', 'https://fonts.gstatic.com'],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * `TECH_DOC` baseline — Docusaurus 3.x SSG. `'unsafe-inline'` on both\n * `script-src` AND `style-src` is required by the Docusaurus runtime\n * (classic-theme bootstrap and hydration shim). `img-src` retains `data:` and\n * `blob:` because the documentation product supports generated/MDX images\n * expressed with those browser-native URL schemes. Fonts are self-hosted; the\n * removed OpenAPI theme's inline icon-font allowance is deliberately gone.\n *\n * Tightening to nonce-based `'self'` only is a post-Slice-B follow-up\n * (would require an upstream Docusaurus runtime change OR a\n * nonce-injecting build plugin — out of scope today).\n */\nconst TECH_DOC_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\", \"'unsafe-inline'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\"],\n 'img-src': [\"'self'\", 'data:', 'blob:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\"],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * `STATIC_WEBSITE` baseline — Astro SSG marketing site. Intentionally\n * narrow `script-src` / `connect-src` to force the per-app config to\n * opt into every third-party hostname (analytics, advertising, chat\n * widget) explicitly. NO implicit `'unsafe-inline'` — the marketing\n * team must opt in per origin (or use nonces / hashes once those are\n * wired by the marketing build plugin).\n *\n * `style-src 'unsafe-inline'` is included because Astro's view\n * transitions and inline scoped styles emit short-lived inline\n * `<style>` tags; stripping that would break the marketing animations\n * the website team relies on.\n *\n * `img-src` includes `https:` because marketing pages routinely embed\n * third-party imagery (case-study screenshots, partner logos hosted on\n * a CDN). Tightening to a closed allow-list per app is the per-app\n * `directives['img-src']` override's job.\n */\nconst STATIC_WEBSITE_BASELINE: CspBaselineDirectiveMap = {\n 'default-src': [\"'self'\"],\n 'script-src': [\"'self'\"],\n 'style-src': [\"'self'\", \"'unsafe-inline'\"],\n 'img-src': [\"'self'\", 'data:', 'blob:', 'https:'],\n 'connect-src': [\"'self'\"],\n 'font-src': [\"'self'\", 'data:'],\n 'frame-ancestors': [\"'none'\"],\n 'object-src': [\"'none'\"],\n 'form-action': [\"'self'\"],\n 'base-uri': [\"'self'\"],\n};\n\n/**\n * Per-`AppFrontendType` baseline registry. Total over the enum — adding\n * a new `AppFrontendType` value forces a baseline edit here at compile\n * time (TS error on the missing key). That coupling is the whole point\n * of the registry shape: a new frontend kind that ships without a CSP\n * baseline would silently get NO policy on any deployment until someone\n * notices.\n */\nexport const CSP_BASELINES: Readonly<\n Record<AppFrontendType, CspBaselineDirectiveMap>\n> = {\n [AppFrontendType.SAAS_APP]: SAAS_APP_BASELINE,\n [AppFrontendType.STATIC_WEBSITE]: STATIC_WEBSITE_BASELINE,\n [AppFrontendType.TECH_DOC]: TECH_DOC_BASELINE,\n};\n"]}
|
|
@@ -224,8 +224,7 @@ export declare const WildoCspConfigSchema: z.ZodObject<{
|
|
|
224
224
|
* ignores it; the resolver feeds it to the nginx channel only).
|
|
225
225
|
* No `report-to` field today — `report-to` requires the parallel
|
|
226
226
|
* Reporting API endpoint config which the platform doesn't ship; add
|
|
227
|
-
* when the violation
|
|
228
|
-
* Bonuses — CSP violation monitoring endpoint").
|
|
227
|
+
* when the violation collector lands (#2867).
|
|
229
228
|
*/
|
|
230
229
|
reportUri: z.ZodOptional<z.ZodString>;
|
|
231
230
|
}, z.core.$strict>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAEH,OA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AC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;OAKG;;IAEH;;;;;;;;;;;OAWG;;IAEH;;;;OAIG;;IAIH;;;OAGG;;IAEH;;;;;;OAMG;;kBAEH,CAAC;AACH,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;OAKG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAEH;;;;;;OAMG;;IAEH;;;OAGG;;kBAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -243,8 +243,7 @@ export const WildoCspConfigSchema = z.strictObject({
|
|
|
243
243
|
* ignores it; the resolver feeds it to the nginx channel only).
|
|
244
244
|
* No `report-to` field today — `report-to` requires the parallel
|
|
245
245
|
* Reporting API endpoint config which the platform doesn't ship; add
|
|
246
|
-
* when the violation
|
|
247
|
-
* Bonuses — CSP violation monitoring endpoint").
|
|
246
|
+
* when the violation collector lands (#2867).
|
|
248
247
|
*/
|
|
249
248
|
reportUri: z.string().min(1).optional(),
|
|
250
249
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csp.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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tB,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC5C;;;OAGG;IACH,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD;;;;;;;OAOG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAKH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD;;;;;OAKG;IACH,eAAe,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxC;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC","sourcesContent":["/**\n * Content-Security-Policy authoring schema for per-frontend opt-in.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default — `./csp-defaults.ts` ships per-`AppFrontendType`\n * baselines (`SAAS_APP`, `STATIC_WEBSITE`, `TECH_DOC`). The baseline\n * is opinionated but conservative: `default-src 'self'` plus the\n * narrowest set of relaxations each frontend kind genuinely needs\n * to render (e.g., Docusaurus 3.x's `'unsafe-inline'` script /\n * style requirement for `TECH_DOC`).\n * 2. App-static — this `WildoCspConfigSchema`, authored on each\n * service-definition's `csp?` field. `SAAS_APP` authors this on\n * `wildo.saas.config.ts > services.<key>.csp`; `STATIC_WEBSITE` authors\n * it on `wildo.website.config.ts`; `TECH_DOC` authors it on\n * `wildo.tech-doc.config.ts`.\n * 3. Env-specific — `EnvCspOverrideSchema` below, authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. `WildoInfraEnvConfigSchema`\n * declares that field, so the layer is live. Its build-time consumer is\n * `wildo dev sync-csp`, which reads `parsed.csp[serviceKey]` when emitting\n * generated frontend CSP artifacts.\n * 4. Declared providers — NOT authored here at all (#332). Each frontend\n * provider declares the origins it needs to reach on its own module, that\n * footprint travels as data into the materialized frontend-services\n * artifact, and `resolveCspPolicy` merges the footprints of the providers\n * declared FOR THIS SERVICE. Layers 1–3 say what the application decided;\n * layer 4 says what the things it declared actually need in order to work,\n * which is why it is additive even under `replace-baseline`.\n *\n * # Resolution semantics (consumed by `platform-config-lib/src/project-config/shared/csp-emit.ts`)\n *\n * - `enabled: false` (default) => no policy emitted; the resolver\n * returns `null` and both nginx + meta channels stay silent. The\n * opt-in shape (vs opt-out) is deliberate — frontends that have not\n * audited their third-party surface should not ship a half-baked\n * CSP that breaks features without protecting anything.\n * - `enabled: true` with no `directives` override => baseline emitted\n * verbatim (see `./csp-defaults.ts`).\n * - `enabled: true` with `directives` AND `mergeStrategy: 'extend-baseline'`\n * (default) => per-directive ADDITIVE merge: each authored source\n * list is concatenated to the baseline's source list for that\n * directive (de-duplicated, baseline order preserved, app sources\n * appended in author order). Directives the baseline doesn't ship\n * are added wholesale.\n * - `enabled: true` with `mergeStrategy: 'replace-baseline'` =>\n * authored `directives` map REPLACES the baseline entirely; missing\n * directives are simply absent from the policy. Use only when the\n * baseline is fundamentally wrong for the surface (e.g., a\n * `STATIC_WEBSITE` that actually serves an embedded SaaS app and\n * wants the tighter `SAAS_APP`-style policy from scratch). The\n * escape hatch exists; the merge default exists for the common\n * case (additive tightening / loosening).\n * - `reportOnly: true` => header name flips to\n * `Content-Security-Policy-Report-Only` AND the `<meta http-equiv>`\n * channel goes silent (browsers reject the report-only header via\n * meta — W3C CSP3 §4.2.1). `reportOnly: false` (default once the\n * pilot triages clean) emits the enforcing header AND the meta\n * tag (with header-only directives stripped from the meta tag —\n * see `META_INVALID_DIRECTIVES` in `csp-emit.ts`).\n * - `reportUri` => header-only directive value (the meta tag would\n * ignore it). The resolver feeds it to the nginx channel only.\n *\n * # Why the `directives` keys are an explicit closed set vs a free-form `Record<string, ...>`\n *\n * CSP grew organically over a decade and a half. The closed set below\n * (`default-src` / `script-src` / `style-src` / `img-src` / `connect-src`\n * / `font-src` / `frame-src` / `frame-ancestors` / `object-src` /\n * `form-action` / `base-uri` / `manifest-src` / `media-src` / `worker-src`)\n * covers every directive the platform's three frontend kinds genuinely\n * use today. Forcing authors to spell directive names through the schema\n * surface (vs `Record<string, string[]>`) catches typos at parse time\n * (`script-source` !== `script-src`) and gives IDE autocompletion. Adding\n * a new directive is a one-line schema edit when a real consumer asks\n * for it; meanwhile the default-deny stance prevents authors from\n * accidentally shipping a directive name the browser silently ignores.\n *\n * # Author-friendly source lists\n *\n * Each directive's value is `string[]`. The resolver does NOT validate\n * the contents of the source list (that would require importing a CSP\n * grammar — out of scope for this commit). Common shapes:\n *\n * - `\"'self'\"` — single-quoted keyword, MUST keep the quotes.\n * - `'data:'`, `'blob:'` — scheme sources.\n * - `'https://api.example.com'` — origin source.\n * - `\"'unsafe-inline'\"`, `\"'unsafe-eval'\"` — single-quoted keywords.\n * - `\"'nonce-<base64>'\"` — nonce keyword (rendered per-request).\n * - `\"'sha256-<hash>'\"` — hash keyword.\n *\n * The `csp-emit.ts` serializer joins source lists with single spaces\n * and separates directives with `; ` (no leading/trailing semicolon —\n * matches Mozilla / OWASP recommended whitespace).\n */\n\nimport { z } from 'zod';\n\n/**\n * Closed set of directive names we accept on the `csp.directives`\n * authoring map. Adding a new directive name requires:\n *\n * 1. Adding the literal here.\n * 2. Updating any per-`AppFrontendType` baseline that should ship the\n * directive by default in `./csp-defaults.ts`.\n * 3. Verifying the `csp-emit.ts` serializer handles the directive\n * (it does — the serializer is generic over directive names — so\n * step 3 is usually a no-op).\n *\n * The `META_INVALID_DIRECTIVES` set in `csp-emit.ts` lists the\n * directives the browser ignores when emitted via `<meta http-equiv>`\n * (`frame-ancestors`, `report-uri`, `report-to`, `sandbox`); they're\n * stripped from the meta-channel output but remain on the nginx\n * channel. Keep that set in sync if a new header-only directive lands\n * here.\n */\nexport const CSP_DIRECTIVE_NAMES = [\n 'default-src',\n 'script-src',\n 'style-src',\n 'img-src',\n 'connect-src',\n 'font-src',\n 'frame-src',\n 'frame-ancestors',\n 'object-src',\n 'form-action',\n 'base-uri',\n 'manifest-src',\n 'media-src',\n 'worker-src',\n] as const;\n\nexport type CspDirectiveName = (typeof CSP_DIRECTIVE_NAMES)[number];\n\n/**\n * Author-side merge strategy for the app-static layer over the baseline.\n *\n * - `'extend-baseline'` (default) — per-directive ADDITIVE merge:\n * each authored source list is APPENDED to the baseline source\n * list for that directive. Directives the baseline doesn't ship\n * are added wholesale. Common case: an app needs to add ONE extra\n * `connect-src` origin without re-authoring the rest of the policy.\n * - `'replace-baseline'` — authored `directives` map REPLACES the\n * baseline entirely. Use when the baseline is fundamentally wrong\n * for the surface (e.g., a tighter or fundamentally different\n * posture). Escape hatch — the merge default is the right answer\n * in 95% of cases.\n */\nexport enum CspMergeStrategy {\n EXTEND_BASELINE = 'extend-baseline',\n REPLACE_BASELINE = 'replace-baseline',\n}\n\n/**\n * Author-side directive overrides — partial map keyed by the closed\n * directive-name set above. Each value is a source list of strings\n * (joined with single spaces by the serializer).\n *\n * Authoring `directives: { 'connect-src': ['https://api.example.com'] }`\n * with the default `'extend-baseline'` strategy APPENDS that origin to\n * the baseline `connect-src` source list (which already contains\n * `'self'` for every baseline) — it does NOT replace the baseline's\n * `connect-src`. Use `mergeStrategy: 'replace-baseline'` to opt out of\n * additive merging.\n */\nexport const CspDirectivesOverrideSchema = z.strictObject(\n Object.fromEntries(\n CSP_DIRECTIVE_NAMES.map((name) => [\n name,\n z.array(z.string().min(1)).optional(),\n ]),\n ) as Record<CspDirectiveName, z.ZodOptional<z.ZodArray<z.ZodString>>>,\n);\nexport type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;\n\n/**\n * @wildo_source:part:start saas.config.content-security-policy facet:layer:shared facet:audience:app-developer\n *\n * Declaring a Content-Security-Policy for one of the application's frontends.\n *\n * ⚠️ **Every browser surface ships a policy; what differs is what happens when you author none.** On\n * the application (`services.<key>.csp`) an omitted block resolves at sync to `enabled: true,\n * reportOnly: true` — a policy that reports violations and blocks nothing. A website or technical-doc\n * config with no block is refused at sync, naming the file. A policy that resolves DISABLED is refused\n * on every surface, so `enabled: false` cannot switch the header off.\n *\n * ## The generated file is the only one read\n *\n * Author the static posture here, add per-environment entries under `csp.<serviceKey>` in that\n * environment's infrastructure configuration, then run `wildo dev sync-csp --env <env>` (starting\n * development runs it for you). Each surface reads ONLY the generated artifact — hand-editing a\n * surface's own policy file changes nothing and is overwritten on the next sync.\n *\n * ## `reportOnly` is a posture, not a formality\n *\n * `reportOnly: true` emits the report-only header: the browser reports violations and BLOCKS\n * NOTHING. Flipping it is one field. Note also that a `report-uri` is supported by the schema and the\n * emitter and no baseline ships a collector, so with nothing authored there the reports a browser\n * generates have nowhere to go — report-only plus no collector is a policy that neither blocks nor\n * tells you anything.\n *\n * Nonces and hashes are not generated per request or at build time. A source list may name one by\n * hand, but there is no generation, which is why a baseline that must admit inline script still does.\n *\n * Per-frontend CSP block. Authored on each service-definition's `csp?`\n * field. All three surfaces carry it: `wildo.tech-doc.config.ts.csp?`,\n * `wildo.website.config.ts.csp?`, and `services.<key>.csp` on the\n * `SAAS_APP` service definition.\n *\n * An AUTHORED block that omits `enabled` parses as `enabled: false`, which the resolver turns into no\n * policy and the sync then refuses — so author `enabled: true` explicitly whenever you write a block.\n *\n * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`\n * (no `d`) or `directive: { … }` (no plural) MUST surface as parse\n * errors, not silently strip to `enabled: false` (i.e. CSP off, the\n * worst possible default). Same framework-mindset enforcement as\n * `WildoAuthConfigSchema`.\n */\nexport const WildoCspConfigSchema = z.strictObject({\n /**\n * `true` => baseline (+ overrides) emitted on both channels per `reportOnly`.\n * `false` — also the parse default for an authored block — makes the resolver return `null`, and\n * `wildo dev sync-csp` refuses that for every CSP-capable surface. It is not a way to turn the\n * header off.\n */\n enabled: z.boolean().default(false),\n /**\n * `true` => header name flips to `Content-Security-Policy-Report-Only`\n * AND the `<meta http-equiv>` channel goes silent (browsers reject the\n * report-only header via meta — W3C CSP3 §4.2.1). Use during the\n * pilot to triage console-surfaced violations without breaking real\n * traffic. Flip to `false` once the directive overrides settle.\n *\n * Default: `false` (enforcing). Authors opting into CSP for the first\n * time SHOULD set `reportOnly: true` for the first PR; the schema\n * default is intentionally enforcing so the steady state (post-pilot)\n * doesn't require a per-app authored `reportOnly: false`.\n */\n reportOnly: z.boolean().default(false),\n /**\n * Merge strategy for authored `directives` over the baseline. Default:\n * `'extend-baseline'` (per-directive additive merge — see\n * `CspMergeStrategy`).\n */\n mergeStrategy: z\n .enum(CspMergeStrategy)\n .default(CspMergeStrategy.EXTEND_BASELINE),\n /**\n * Per-directive overrides, keyed by directive name. Default: empty\n * map (baseline emitted verbatim).\n */\n directives: CspDirectivesOverrideSchema.default({}),\n /**\n * Optional `report-uri` directive value (header-only — meta tag\n * ignores it; the resolver feeds it to the nginx channel only).\n * No `report-to` field today — `report-to` requires the parallel\n * Reporting API endpoint config which the platform doesn't ship; add\n * when the violation-collector lands (`auth-hardening.md` \"Cheap\n * Bonuses — CSP violation monitoring endpoint\").\n */\n reportUri: z.string().min(1).optional(),\n});\n/** @wildo_source:part:end saas.config.content-security-policy */\nexport type WildoCspConfig = z.infer<typeof WildoCspConfigSchema>;\nexport type WildoCspConfigInput = z.input<typeof WildoCspConfigSchema>;\n\n/**\n * Env-specific overrides — authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The loader merges\n * these on top of the app-static layer (which itself is on top of the\n * baseline).\n *\n * `WildoInfraEnvConfigSchema` declares `csp` as a record of these,\n * keyed by service key, and the resolver in `csp-emit.ts` consumes it.\n *\n * `extraDirectives` is ADDITIVE only — env-layer entries are APPENDED\n * to whatever the app-static layer produced for that directive. There\n * is no `'replace-baseline'`-equivalent at the env layer because env\n * config exists to LOOSEN policies for specific deployments (Sentry\n * origin in staging, dev hot-reload `'unsafe-eval'`), not to replace\n * an app's chosen posture. If an env genuinely needs a different\n * posture the right answer is to fix the app-static layer.\n */\nexport const EnvCspOverrideSchema = z.strictObject({\n /**\n * Per-directive ADDITIVE merge. Each entry's source list is\n * APPENDED to the app-static layer's source list for that directive\n * (de-duplicated, app order preserved, env sources appended in\n * author order). No replace semantics at this layer.\n */\n extraDirectives: CspDirectivesOverrideSchema.default({}),\n /**\n * Vite dev-mode CSP loosening: adds BOTH `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`. Vite's dev server injects an\n * inline `<script>` for the HMR client bootstrap AND uses `eval()`\n * for lazy module / sourcemap transforms — both block under a strict\n * `script-src 'self'` policy and produce ~120+ CSP violations per\n * page load. Production Vite builds emit `<script type=\"module\">`\n * only and use no `eval()`, so this loosening is dev-only by design.\n *\n * AUTO-DEFAULT: `true` when the resolved env id is `'local'` AND the\n * frontend type is `SAAS_APP` (the only Vite-bundled frontend kind in\n * the framework). The framework applies the loosening automatically so\n * every Wildo app gets a clean dev console without per-app\n * configuration; opting in app-by-app would scatter the same\n * framework-shipped Vite knowledge across N infrastructure files.\n *\n * EXPLICIT OPT-OUT: set to `false` to keep tight `script-src` in\n * local dev. Useful only when actively debugging a real CSP issue\n * and willing to accept Vite-induced noise. Production envs ignore\n * this flag's auto-default and require explicit opt-in (extremely\n * unusual — a production app that needs `'unsafe-inline'` /\n * `'unsafe-eval'` is almost always a sign of a misconfigured asset\n * pipeline).\n */\n viteDevLoosening: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportOnly` flag. When\n * present (not `undefined`), takes precedence over the app-static\n * value. Common shape: app-static ships `reportOnly: false`\n * (enforcing in prod), env-layer flips to `reportOnly: true` for\n * staging while the violation collector ramps up.\n */\n reportOnly: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportUri` (e.g., per-env\n * collector endpoint).\n */\n reportUri: z.string().min(1).optional(),\n});\nexport type EnvCspOverride = z.infer<typeof EnvCspOverrideSchema>;\nexport type EnvCspOverrideInput = z.input<typeof EnvCspOverrideSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"csp.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/csp.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,aAAa;IACb,YAAY;IACZ,WAAW;IACX,SAAS;IACT,aAAa;IACb,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,UAAU;IACV,cAAc;IACd,WAAW;IACX,YAAY;CACJ,CAAC;AAIX;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uDAAmC,CAAA;IACnC,yDAAqC,CAAA;AACvC,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CACvD,MAAM,CAAC,WAAW,CAChB,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAChC,IAAI;IACJ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC,CACiE,CACtE,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD;;;;;OAKG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACtC;;;;OAIG;IACH,aAAa,EAAE,CAAC;SACb,IAAI,CAAC,gBAAgB,CAAC;SACtB,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC5C;;;OAGG;IACH,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAKH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD;;;;;OAKG;IACH,eAAe,EAAE,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxC;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC","sourcesContent":["/**\n * Content-Security-Policy authoring schema for per-frontend opt-in.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default — `./csp-defaults.ts` ships per-`AppFrontendType`\n * baselines (`SAAS_APP`, `STATIC_WEBSITE`, `TECH_DOC`). The baseline\n * is opinionated but conservative: `default-src 'self'` plus the\n * narrowest set of relaxations each frontend kind genuinely needs\n * to render (e.g., Docusaurus 3.x's `'unsafe-inline'` script /\n * style requirement for `TECH_DOC`).\n * 2. App-static — this `WildoCspConfigSchema`, authored on each\n * service-definition's `csp?` field. `SAAS_APP` authors this on\n * `wildo.saas.config.ts > services.<key>.csp`; `STATIC_WEBSITE` authors\n * it on `wildo.website.config.ts`; `TECH_DOC` authors it on\n * `wildo.tech-doc.config.ts`.\n * 3. Env-specific — `EnvCspOverrideSchema` below, authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. `WildoInfraEnvConfigSchema`\n * declares that field, so the layer is live. Its build-time consumer is\n * `wildo dev sync-csp`, which reads `parsed.csp[serviceKey]` when emitting\n * generated frontend CSP artifacts.\n * 4. Declared providers — NOT authored here at all (#332). Each frontend\n * provider declares the origins it needs to reach on its own module, that\n * footprint travels as data into the materialized frontend-services\n * artifact, and `resolveCspPolicy` merges the footprints of the providers\n * declared FOR THIS SERVICE. Layers 1–3 say what the application decided;\n * layer 4 says what the things it declared actually need in order to work,\n * which is why it is additive even under `replace-baseline`.\n *\n * # Resolution semantics (consumed by `platform-config-lib/src/project-config/shared/csp-emit.ts`)\n *\n * - `enabled: false` (default) => no policy emitted; the resolver\n * returns `null` and both nginx + meta channels stay silent. The\n * opt-in shape (vs opt-out) is deliberate — frontends that have not\n * audited their third-party surface should not ship a half-baked\n * CSP that breaks features without protecting anything.\n * - `enabled: true` with no `directives` override => baseline emitted\n * verbatim (see `./csp-defaults.ts`).\n * - `enabled: true` with `directives` AND `mergeStrategy: 'extend-baseline'`\n * (default) => per-directive ADDITIVE merge: each authored source\n * list is concatenated to the baseline's source list for that\n * directive (de-duplicated, baseline order preserved, app sources\n * appended in author order). Directives the baseline doesn't ship\n * are added wholesale.\n * - `enabled: true` with `mergeStrategy: 'replace-baseline'` =>\n * authored `directives` map REPLACES the baseline entirely; missing\n * directives are simply absent from the policy. Use only when the\n * baseline is fundamentally wrong for the surface (e.g., a\n * `STATIC_WEBSITE` that actually serves an embedded SaaS app and\n * wants the tighter `SAAS_APP`-style policy from scratch). The\n * escape hatch exists; the merge default exists for the common\n * case (additive tightening / loosening).\n * - `reportOnly: true` => header name flips to\n * `Content-Security-Policy-Report-Only` AND the `<meta http-equiv>`\n * channel goes silent (browsers reject the report-only header via\n * meta — W3C CSP3 §4.2.1). `reportOnly: false` (default once the\n * pilot triages clean) emits the enforcing header AND the meta\n * tag (with header-only directives stripped from the meta tag —\n * see `META_INVALID_DIRECTIVES` in `csp-emit.ts`).\n * - `reportUri` => header-only directive value (the meta tag would\n * ignore it). The resolver feeds it to the nginx channel only.\n *\n * # Why the `directives` keys are an explicit closed set vs a free-form `Record<string, ...>`\n *\n * CSP grew organically over a decade and a half. The closed set below\n * (`default-src` / `script-src` / `style-src` / `img-src` / `connect-src`\n * / `font-src` / `frame-src` / `frame-ancestors` / `object-src` /\n * `form-action` / `base-uri` / `manifest-src` / `media-src` / `worker-src`)\n * covers every directive the platform's three frontend kinds genuinely\n * use today. Forcing authors to spell directive names through the schema\n * surface (vs `Record<string, string[]>`) catches typos at parse time\n * (`script-source` !== `script-src`) and gives IDE autocompletion. Adding\n * a new directive is a one-line schema edit when a real consumer asks\n * for it; meanwhile the default-deny stance prevents authors from\n * accidentally shipping a directive name the browser silently ignores.\n *\n * # Author-friendly source lists\n *\n * Each directive's value is `string[]`. The resolver does NOT validate\n * the contents of the source list (that would require importing a CSP\n * grammar — out of scope for this commit). Common shapes:\n *\n * - `\"'self'\"` — single-quoted keyword, MUST keep the quotes.\n * - `'data:'`, `'blob:'` — scheme sources.\n * - `'https://api.example.com'` — origin source.\n * - `\"'unsafe-inline'\"`, `\"'unsafe-eval'\"` — single-quoted keywords.\n * - `\"'nonce-<base64>'\"` — nonce keyword (rendered per-request).\n * - `\"'sha256-<hash>'\"` — hash keyword.\n *\n * The `csp-emit.ts` serializer joins source lists with single spaces\n * and separates directives with `; ` (no leading/trailing semicolon —\n * matches Mozilla / OWASP recommended whitespace).\n */\n\nimport { z } from 'zod';\n\n/**\n * Closed set of directive names we accept on the `csp.directives`\n * authoring map. Adding a new directive name requires:\n *\n * 1. Adding the literal here.\n * 2. Updating any per-`AppFrontendType` baseline that should ship the\n * directive by default in `./csp-defaults.ts`.\n * 3. Verifying the `csp-emit.ts` serializer handles the directive\n * (it does — the serializer is generic over directive names — so\n * step 3 is usually a no-op).\n *\n * The `META_INVALID_DIRECTIVES` set in `csp-emit.ts` lists the\n * directives the browser ignores when emitted via `<meta http-equiv>`\n * (`frame-ancestors`, `report-uri`, `report-to`, `sandbox`); they're\n * stripped from the meta-channel output but remain on the nginx\n * channel. Keep that set in sync if a new header-only directive lands\n * here.\n */\nexport const CSP_DIRECTIVE_NAMES = [\n 'default-src',\n 'script-src',\n 'style-src',\n 'img-src',\n 'connect-src',\n 'font-src',\n 'frame-src',\n 'frame-ancestors',\n 'object-src',\n 'form-action',\n 'base-uri',\n 'manifest-src',\n 'media-src',\n 'worker-src',\n] as const;\n\nexport type CspDirectiveName = (typeof CSP_DIRECTIVE_NAMES)[number];\n\n/**\n * Author-side merge strategy for the app-static layer over the baseline.\n *\n * - `'extend-baseline'` (default) — per-directive ADDITIVE merge:\n * each authored source list is APPENDED to the baseline source\n * list for that directive. Directives the baseline doesn't ship\n * are added wholesale. Common case: an app needs to add ONE extra\n * `connect-src` origin without re-authoring the rest of the policy.\n * - `'replace-baseline'` — authored `directives` map REPLACES the\n * baseline entirely. Use when the baseline is fundamentally wrong\n * for the surface (e.g., a tighter or fundamentally different\n * posture). Escape hatch — the merge default is the right answer\n * in 95% of cases.\n */\nexport enum CspMergeStrategy {\n EXTEND_BASELINE = 'extend-baseline',\n REPLACE_BASELINE = 'replace-baseline',\n}\n\n/**\n * Author-side directive overrides — partial map keyed by the closed\n * directive-name set above. Each value is a source list of strings\n * (joined with single spaces by the serializer).\n *\n * Authoring `directives: { 'connect-src': ['https://api.example.com'] }`\n * with the default `'extend-baseline'` strategy APPENDS that origin to\n * the baseline `connect-src` source list (which already contains\n * `'self'` for every baseline) — it does NOT replace the baseline's\n * `connect-src`. Use `mergeStrategy: 'replace-baseline'` to opt out of\n * additive merging.\n */\nexport const CspDirectivesOverrideSchema = z.strictObject(\n Object.fromEntries(\n CSP_DIRECTIVE_NAMES.map((name) => [\n name,\n z.array(z.string().min(1)).optional(),\n ]),\n ) as Record<CspDirectiveName, z.ZodOptional<z.ZodArray<z.ZodString>>>,\n);\nexport type CspDirectivesOverride = z.infer<typeof CspDirectivesOverrideSchema>;\n\n/**\n * @wildo_source:part:start saas.config.content-security-policy facet:layer:shared facet:audience:app-developer\n *\n * Declaring a Content-Security-Policy for one of the application's frontends.\n *\n * ⚠️ **Every browser surface ships a policy; what differs is what happens when you author none.** On\n * the application (`services.<key>.csp`) an omitted block resolves at sync to `enabled: true,\n * reportOnly: true` — a policy that reports violations and blocks nothing. A website or technical-doc\n * config with no block is refused at sync, naming the file. A policy that resolves DISABLED is refused\n * on every surface, so `enabled: false` cannot switch the header off.\n *\n * ## The generated file is the only one read\n *\n * Author the static posture here, add per-environment entries under `csp.<serviceKey>` in that\n * environment's infrastructure configuration, then run `wildo dev sync-csp --env <env>` (starting\n * development runs it for you). Each surface reads ONLY the generated artifact — hand-editing a\n * surface's own policy file changes nothing and is overwritten on the next sync.\n *\n * ## `reportOnly` is a posture, not a formality\n *\n * `reportOnly: true` emits the report-only header: the browser reports violations and BLOCKS\n * NOTHING. Flipping it is one field. Note also that a `report-uri` is supported by the schema and the\n * emitter and no baseline ships a collector, so with nothing authored there the reports a browser\n * generates have nowhere to go — report-only plus no collector is a policy that neither blocks nor\n * tells you anything.\n *\n * Nonces and hashes are not generated per request or at build time. A source list may name one by\n * hand, but there is no generation, which is why a baseline that must admit inline script still does.\n *\n * Per-frontend CSP block. Authored on each service-definition's `csp?`\n * field. All three surfaces carry it: `wildo.tech-doc.config.ts.csp?`,\n * `wildo.website.config.ts.csp?`, and `services.<key>.csp` on the\n * `SAAS_APP` service definition.\n *\n * An AUTHORED block that omits `enabled` parses as `enabled: false`, which the resolver turns into no\n * policy and the sync then refuses — so author `enabled: true` explicitly whenever you write a block.\n *\n * `z.strictObject` (Zod 4) is intentional — typos like `enable: true`\n * (no `d`) or `directive: { … }` (no plural) MUST surface as parse\n * errors, not silently strip to `enabled: false` (i.e. CSP off, the\n * worst possible default). Same framework-mindset enforcement as\n * `WildoAuthConfigSchema`.\n */\nexport const WildoCspConfigSchema = z.strictObject({\n /**\n * `true` => baseline (+ overrides) emitted on both channels per `reportOnly`.\n * `false` — also the parse default for an authored block — makes the resolver return `null`, and\n * `wildo dev sync-csp` refuses that for every CSP-capable surface. It is not a way to turn the\n * header off.\n */\n enabled: z.boolean().default(false),\n /**\n * `true` => header name flips to `Content-Security-Policy-Report-Only`\n * AND the `<meta http-equiv>` channel goes silent (browsers reject the\n * report-only header via meta — W3C CSP3 §4.2.1). Use during the\n * pilot to triage console-surfaced violations without breaking real\n * traffic. Flip to `false` once the directive overrides settle.\n *\n * Default: `false` (enforcing). Authors opting into CSP for the first\n * time SHOULD set `reportOnly: true` for the first PR; the schema\n * default is intentionally enforcing so the steady state (post-pilot)\n * doesn't require a per-app authored `reportOnly: false`.\n */\n reportOnly: z.boolean().default(false),\n /**\n * Merge strategy for authored `directives` over the baseline. Default:\n * `'extend-baseline'` (per-directive additive merge — see\n * `CspMergeStrategy`).\n */\n mergeStrategy: z\n .enum(CspMergeStrategy)\n .default(CspMergeStrategy.EXTEND_BASELINE),\n /**\n * Per-directive overrides, keyed by directive name. Default: empty\n * map (baseline emitted verbatim).\n */\n directives: CspDirectivesOverrideSchema.default({}),\n /**\n * Optional `report-uri` directive value (header-only — meta tag\n * ignores it; the resolver feeds it to the nginx channel only).\n * No `report-to` field today — `report-to` requires the parallel\n * Reporting API endpoint config which the platform doesn't ship; add\n * when the violation collector lands (#2867).\n */\n reportUri: z.string().min(1).optional(),\n});\n/** @wildo_source:part:end saas.config.content-security-policy */\nexport type WildoCspConfig = z.infer<typeof WildoCspConfigSchema>;\nexport type WildoCspConfigInput = z.input<typeof WildoCspConfigSchema>;\n\n/**\n * Env-specific overrides — authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The loader merges\n * these on top of the app-static layer (which itself is on top of the\n * baseline).\n *\n * `WildoInfraEnvConfigSchema` declares `csp` as a record of these,\n * keyed by service key, and the resolver in `csp-emit.ts` consumes it.\n *\n * `extraDirectives` is ADDITIVE only — env-layer entries are APPENDED\n * to whatever the app-static layer produced for that directive. There\n * is no `'replace-baseline'`-equivalent at the env layer because env\n * config exists to LOOSEN policies for specific deployments (Sentry\n * origin in staging, dev hot-reload `'unsafe-eval'`), not to replace\n * an app's chosen posture. If an env genuinely needs a different\n * posture the right answer is to fix the app-static layer.\n */\nexport const EnvCspOverrideSchema = z.strictObject({\n /**\n * Per-directive ADDITIVE merge. Each entry's source list is\n * APPENDED to the app-static layer's source list for that directive\n * (de-duplicated, app order preserved, env sources appended in\n * author order). No replace semantics at this layer.\n */\n extraDirectives: CspDirectivesOverrideSchema.default({}),\n /**\n * Vite dev-mode CSP loosening: adds BOTH `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`. Vite's dev server injects an\n * inline `<script>` for the HMR client bootstrap AND uses `eval()`\n * for lazy module / sourcemap transforms — both block under a strict\n * `script-src 'self'` policy and produce ~120+ CSP violations per\n * page load. Production Vite builds emit `<script type=\"module\">`\n * only and use no `eval()`, so this loosening is dev-only by design.\n *\n * AUTO-DEFAULT: `true` when the resolved env id is `'local'` AND the\n * frontend type is `SAAS_APP` (the only Vite-bundled frontend kind in\n * the framework). The framework applies the loosening automatically so\n * every Wildo app gets a clean dev console without per-app\n * configuration; opting in app-by-app would scatter the same\n * framework-shipped Vite knowledge across N infrastructure files.\n *\n * EXPLICIT OPT-OUT: set to `false` to keep tight `script-src` in\n * local dev. Useful only when actively debugging a real CSP issue\n * and willing to accept Vite-induced noise. Production envs ignore\n * this flag's auto-default and require explicit opt-in (extremely\n * unusual — a production app that needs `'unsafe-inline'` /\n * `'unsafe-eval'` is almost always a sign of a misconfigured asset\n * pipeline).\n */\n viteDevLoosening: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportOnly` flag. When\n * present (not `undefined`), takes precedence over the app-static\n * value. Common shape: app-static ships `reportOnly: false`\n * (enforcing in prod), env-layer flips to `reportOnly: true` for\n * staging while the violation collector ramps up.\n */\n reportOnly: z.boolean().optional(),\n /**\n * Env-layer override of the app-static `reportUri` (e.g., per-env\n * collector endpoint).\n */\n reportUri: z.string().min(1).optional(),\n});\nexport type EnvCspOverride = z.infer<typeof EnvCspOverrideSchema>;\nexport type EnvCspOverrideInput = z.input<typeof EnvCspOverrideSchema>;\n"]}
|
|
@@ -232,6 +232,12 @@ export type WildoProviderSelectionOverrides = z.infer<typeof WildoProviderSelect
|
|
|
232
232
|
* SaaS block KEY BY KEY. An environment therefore states only what differs and inherits the rest, so the policy half
|
|
233
233
|
* is never restated per environment.
|
|
234
234
|
*
|
|
235
|
+
* The second level is a protocol kind for what a RUNTIME reads, and may also be a key the provider MODULE owns and
|
|
236
|
+
* reads itself: `registration`, the vendor-side settings its `vendorRegistration` builds from (a Slack app's slash
|
|
237
|
+
* commands, a Teams package's version), read only by `wildo providers register` (#2661, #2663). No runtime reader
|
|
238
|
+
* looks it up, since each reads its own protocol kind, so it travels unused beside them; it lives here so that an
|
|
239
|
+
* environment can lay its own registration over the application's, like any other value.
|
|
240
|
+
*
|
|
235
241
|
* It reaches both places a provider configuration is read, because the CLI applies the overlay where it knows the
|
|
236
242
|
* environment: the managed declaration each environment's apps-manager stores (backend readers — the OAuth2
|
|
237
243
|
* connection resolver, email/SMS senders, the provider registry) and the provider runtime artifacts a build bakes in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/environment.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"environment.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/environment.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;;;;;;GAQG;AACH,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,wBAAwB,aAMlC,CAAC;AACJ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;GAKG;AACH,oBAAY,sBAAsB;IAChC,cAAc,mBAAmB;IACjC,UAAU,eAAe;CAC1B;AAED,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,oBAAY,qBAAqB;IAC/B,aAAa,kBAAkB;IAC/B,SAAS,cAAc;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,iBAAiB,GAAG,qBAAqB,CAOrG;AAED;;;;;GAKG;AACH,oBAAY,2BAA2B;IACrC,OAAO,YAAY;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B;;;;;;iBAetC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,cAAc;IACxB,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;CAC5C;AAED,eAAO,MAAM,yBAAyB;;;;;;iBAgBpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,C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mC,EAAE,cAA0C,CAAC;AAE7F;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAAC,mBAAmB,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAA;CAAE,GAAG,SAAS,GAAG,cAAc,CAEtI;AAED,oBAAY,qBAAqB;IAC/B,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;kBAIxC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;;kBAKrC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;+BAGtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,oEAAoE;AAEpE;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,MAAM,CAYR;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kCAAkC;;;;iBAgB7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EngineCapability } from '@wildo-ai/saas-models';
|
|
3
|
+
import { refuseModuleOwnedProviderConfigurationKeys } from '@wildo-ai/external-connectors-models';
|
|
3
4
|
import { InfraServiceK8sSchema } from './infra-service.schemas.js';
|
|
4
5
|
/**
|
|
5
6
|
* @wildo_source:part:start platform.config.environment.deployment facet:layer:platform facet:family:infra
|
|
@@ -296,6 +297,12 @@ export const WildoProviderSelectionOverridesSchema = z.partialRecord(z.enum(Engi
|
|
|
296
297
|
* SaaS block KEY BY KEY. An environment therefore states only what differs and inherits the rest, so the policy half
|
|
297
298
|
* is never restated per environment.
|
|
298
299
|
*
|
|
300
|
+
* The second level is a protocol kind for what a RUNTIME reads, and may also be a key the provider MODULE owns and
|
|
301
|
+
* reads itself: `registration`, the vendor-side settings its `vendorRegistration` builds from (a Slack app's slash
|
|
302
|
+
* commands, a Teams package's version), read only by `wildo providers register` (#2661, #2663). No runtime reader
|
|
303
|
+
* looks it up, since each reads its own protocol kind, so it travels unused beside them; it lives here so that an
|
|
304
|
+
* environment can lay its own registration over the application's, like any other value.
|
|
305
|
+
*
|
|
299
306
|
* It reaches both places a provider configuration is read, because the CLI applies the overlay where it knows the
|
|
300
307
|
* environment: the managed declaration each environment's apps-manager stores (backend readers — the OAuth2
|
|
301
308
|
* connection resolver, email/SMS senders, the provider registry) and the provider runtime artifacts a build bakes in
|
|
@@ -304,7 +311,7 @@ export const WildoProviderSelectionOverridesSchema = z.partialRecord(z.enum(Engi
|
|
|
304
311
|
* NOT for secrets. This file is committed; a client secret, API key or signing secret stays in
|
|
305
312
|
* `secrets.json → providerEnv`. The CLI refuses a key named like one of the provider's declared secrets.
|
|
306
313
|
*/
|
|
307
|
-
export const WildoEnvironmentProviderConfigurationsSchema = z.record(z.string().min(1), z.record(z.string().min(1), z.record(z.string().min(1), z.unknown())));
|
|
314
|
+
export const WildoEnvironmentProviderConfigurationsSchema = z.record(z.string().min(1), z.record(z.string().min(1), z.record(z.string().min(1), z.unknown()))).superRefine(refuseModuleOwnedProviderConfigurationKeys);
|
|
308
315
|
/**
|
|
309
316
|
* The provider configuration ONE environment runs with: the application-level `providerConfigurations`, with the
|
|
310
317
|
* environment's {@link WildoEnvironmentProviderConfigurationsSchema} values laid over it key by key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/environment.schemas.ts"],"names":[],"mappings":"AAAA,OAA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uB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,GAAG,iBAAiB,IAAI,uBAAuB,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,OAAe,EACf,aAAqB;IAErB,OAAO,GAAG,yBAAyB,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C;;;OAGG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C;;;OAGG;IACH,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { InfraServiceK8sSchema } from './infra-service.schemas';\n\n/**\n * @wildo_source:part:start platform.config.environment.deployment facet:layer:platform facet:family:infra\n *\n * Convenience environment ids kept for common local/staging/production setups.\n *\n * The project model is no longer limited to a fixed environment set: remote\n * environment ids can be any slug-like value. Use `WildoEnvironmentIdSchema`\n * for authoritative validation.\n */\nexport enum WildoEnvironment {\n LOCAL = 'local',\n STAGING = 'staging',\n PRODUCTION = 'production',\n}\n\nexport const WildoEnvironmentIdSchema = z\n .string()\n .min(1)\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'environment ids must be lowercase alphanumeric with optional hyphen-separated segments',\n );\nexport type WildoEnvironmentId = z.infer<typeof WildoEnvironmentIdSchema>;\n\n/**\n * Deployment runtime targets for CI/CD workflows and infra config.\n *\n * Single source of truth for deployment runtime targets, used by both\n * platform-config-lib (developer-facing config) and wildo-cli (operational).\n */\nexport enum WildoDeploymentRuntime {\n DOCKER_COMPOSE = 'docker-compose',\n KUBERNETES = 'kubernetes',\n}\n\nexport enum WildoLocationType {\n LOCAL = 'local',\n REMOTE = 'remote',\n}\n\nexport function isLocalEnvironmentId(environmentId: string): boolean {\n return environmentId === WildoEnvironment.LOCAL;\n}\n\n/**\n * Where a docker-compose backing service keeps its DATA.\n *\n * The two members are not a performance knob with a fast and a slow setting — they answer a\n * question about ownership, and the cost follows from the answer:\n *\n * - `HOST_PATH` — the data lives at an explicit path on the host\n * (`<saas-root>/.wildo-saas/local_data/<service>/`), bind-mounted into the container. The\n * operator chooses the disk, backups target a known directory, and the tree is the same one the\n * Kind k8s lane hostPath-mounts at `/mnt/local-data/<service>/`. That control is why it is the\n * REMOTE default: a production operator who has provisioned a dedicated data volume must be able\n * to put the database on it, and a named volume would silently land it under\n * `/var/lib/docker/volumes/` on the root disk.\n * - `DOCKER_VOLUME` — the data lives in a Docker named volume, inside the container runtime's own\n * storage. Nobody outside Docker addresses it, which is exactly what makes it right for a\n * disposable development stack.\n *\n * ## Why LOCAL defaults to `DOCKER_VOLUME`\n *\n * On Linux a bind mount is a native path and costs nothing. On macOS and Windows the container\n * runtime is a VM, and a host bind mount crosses a filesystem bridge — VirtioFS on macOS, 9p/\n * VirtioFS through WSL2 on Windows. Databases do small fsync'd random writes, so every one of them\n * becomes a round trip out of the VM.\n *\n * Measured on macOS (Apple Virtualization, 6 vCPU) on 2026-09-22 with the eight self-hosted backing\n * services bind-mounted: the VM process held **13,786 host file descriptors** open across 14,168\n * files and burned **383% CPU** in Docker Desktop's file-sharing process — sustained, a 321%\n * average over 2 days 5 hours — while the containers themselves used 0.7 of a core and container\n * block-IO accounting stayed flat, because none of that traffic reaches the VM's own block device.\n * Roughly four cores of pure filesystem translation for 0.7 of a core of database work.\n *\n * The default is uniform across all three development operating systems rather than \"volumes on\n * macOS and Windows, host paths on Linux\", so every developer and CI run exercise the same stack\n * and a bug reproduces the same way everywhere. It costs a Linux developer nothing: a named volume\n * is a native directory there too.\n *\n * Both members are authorable per environment (`localDataStorage`), so a remote operator who wants\n * volumes and a local developer who wants to read the files from their file manager each say so.\n *\n * NOTE this governs DATA directories only. The two small secret FILES compose mounts read-only —\n * immudb's state-signing key and mongot's sync-source password — are materialized from\n * `secrets.json` onto the host and stay host mounts under every mode. They are read once at\n * startup, so they carry none of the cost above, and they have nowhere else to come from.\n */\nexport enum WildoLocalDataStorage {\n DOCKER_VOLUME = 'docker-volume',\n HOST_PATH = 'host-path',\n}\n\n/**\n * The `localDataStorage` an environment gets when it authors none.\n *\n * Total over {@link WildoLocationType} rather than a conditional on one member, so a location type\n * added to the vocabulary tomorrow is a compile error here instead of silently inheriting whichever\n * branch happened to be the `else`.\n */\nexport function resolveDefaultLocalDataStorage(locationType: WildoLocationType): WildoLocalDataStorage {\n switch (locationType) {\n case WildoLocationType.LOCAL:\n return WildoLocalDataStorage.DOCKER_VOLUME;\n case WildoLocationType.REMOTE:\n return WildoLocalDataStorage.HOST_PATH;\n }\n}\n\n/**\n * Ingress controller installed by Wildo's local and remote Kubernetes workflows.\n * Import from `@wildo-ai/platform-config-lib`. Traefik owns both application\n * routing and HTTP-01 challenge routing; selecting another controller is not\n * supported by the generated installation contract.\n */\nexport enum WildoKubernetesIngressClass {\n TRAEFIK = 'traefik',\n}\n\n/**\n * K8s-internal cluster topology. Holds ONLY values that are genuinely\n * specific to a Kubernetes deployment: namespace, ingress class and\n * per-service workload replica counts.\n *\n * The external/public hostname (where browsers and reverse proxies hit\n * us) is NOT here — it lives at the top level of `WildoInfraEnvConfig`\n * as `publicDomain` because it applies to BOTH `KUBERNETES` and\n * `DOCKER_COMPOSE` runtimes. See `external-public-domain-rename.md`\n * for the rationale (the previous `baseDomain` field on this object\n * conflated K8s-internal and reverse-proxy concerns).\n */\nexport const WildoKubernetesConfigSchema = z.object({\n namespace: z.string().min(1),\n /**\n * Workload replica overrides keyed by authored SaaS service key (for example\n * backendApi, app or website), never by generated image/deployment name.\n * Platform service keys have their own renderer. Worker replicas remain in\n * the worker declaration; a key without a generated application target is\n * reported by application deployment generation rather than guessed.\n */\n services: z.record(z.string(), InfraServiceK8sSchema).optional(),\n // Derive the literal from the named runtime vocabulary while accepting the\n // natural authored spelling `ingressClass: 'traefik'` without an enum import.\n ingressClass: z.literal(`${WildoKubernetesIngressClass.TRAEFIK}`, {\n error: 'Wildo Kubernetes deployments support ingressClass traefik only; omit the field or select traefik.',\n }).optional(),\n});\nexport type WildoKubernetesConfig = z.infer<typeof WildoKubernetesConfigSchema>;\n\n/**\n * cert-manager `ClusterIssuer` selection for remote TLS. Both issuers are\n * always provisioned in the cluster (see `cluster-issuer.yaml.hbs`); this\n * picks which one an application's ingress annotation\n * (`cert-manager.io/cluster-issuer`) points at — i.e. which ACME endpoint\n * issues its per-ingress certificate.\n *\n * - `LETSENCRYPT_PROD` — real, browser-trusted certificates. The default,\n * because a remote deployment implies a real domain that browsers must\n * trust. Subject to Let's Encrypt production rate limits\n * (50 certs / registered domain / week).\n * - `LETSENCRYPT_STAGING` — untrusted test certificates with far higher\n * rate limits. Opt into this **while validating DNS + ingress on a new\n * cluster** so a misconfigured first deploy cannot exhaust the prod\n * quota, then flip to prod once issuance succeeds.\n */\nexport enum WildoTlsIssuer {\n LETSENCRYPT_PROD = 'letsencrypt-prod',\n LETSENCRYPT_STAGING = 'letsencrypt-staging',\n}\n\nexport const WildoRemoteProviderSchema = z.object({\n provider: z.string().min(1),\n registryEndpoint: z.string().min(1),\n region: z.string().min(1).optional(),\n /**\n * ACME registration email for Let's Encrypt (`ClusterIssuer.spec.acme.email`).\n * Optional at the schema level so non-TLS remote configs parse, but a\n * remote Kubernetes environment that terminates TLS should author it —\n * Let's Encrypt uses it for expiry warnings and account recovery.\n */\n acmeEmail: z.email().optional(),\n /**\n * Which cert-manager `ClusterIssuer` this environment's ingresses use.\n * Defaults to `LETSENCRYPT_PROD` downstream when unset. See {@link WildoTlsIssuer}.\n */\n tlsIssuer: z.enum(WildoTlsIssuer).optional(),\n});\nexport type WildoRemoteProvider = z.infer<typeof WildoRemoteProviderSchema>;\n\nexport const WildoLoggingConfigSchema = z.object({\n level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),\n formattedConsoleErrors: z.boolean().optional(),\n});\nexport type WildoLoggingConfig = z.infer<typeof WildoLoggingConfigSchema>;\n\n/**\n * Per-environment OTLP telemetry (traces + metrics + logs) posture (Slice 2 Phase 5).\n *\n * `env-vars-builder` projects this block onto the standard `OTEL_*` env vars that the\n * `otel-preload.ts` SDK (in `saas-backend-lib`) reads BEFORE app code:\n * - `enabled` → `OTEL_ENABLED` (the master gate) + drives the `--import` preload wiring.\n * - `endpoint` → `OTEL_EXPORTER_OTLP_ENDPOINT` (the OTLP/HTTP collector/ingest URL).\n * The provider auth header (`OTEL_EXPORTER_OTLP_HEADERS`) is NOT authored here — it is\n * derived by `env-vars-builder` from the selected `OBSERVABILITY_TELEMETRY` provider's\n * secret (e.g. a BetterStack source token). Persisted into `PlatformEnvConfigJson.observability`\n * and hydrated back by `hydrateEnvironmentFromConfig`, mirroring `logging`.\n */\nexport const WildoObservabilityConfigSchema = z.object({\n /**\n * Master switch for OTLP telemetry. `true` → emit `OTEL_ENABLED=true` + wire the\n * `--import @wildo-ai/saas-backend-lib/otel-preload` preload; the preload starts the SDK.\n * `false`/omitted → a complete no-op (the preload self-gates).\n */\n enabled: z.boolean().default(false),\n /**\n * OTLP/HTTP endpoint (`OTEL_EXPORTER_OTLP_ENDPOINT`). Local dev: the local `otel-collector`\n * (`http://localhost:4318`). Remote: the selected provider's ingesting host (e.g. a BetterStack\n * source URL). When omitted, the OTLP exporters fall back to their own default\n * (`http://localhost:4318`), which is the local collector — convenient for local dev.\n */\n endpoint: z.string().optional(),\n /**\n * LLM-call observability env-layer posture — a SEPARATE signal from OTLP\n * telemetry (fed by the engine `AgentCallTraceSink` into the selected\n * `LLM_OBSERVABILITY` provider, e.g. PostHog `$ai_generation`), colocated\n * here because both are per-environment observability posture. Projected\n * onto the `WILDO_LLM_OBS_*` env vars INDEPENDENTLY of the OTLP `enabled`\n * gate — LLM-obs activation is provider-selection-driven, not\n * `OTEL_ENABLED`-driven.\n */\n llmObservability: z.object({\n /**\n * Forward prompt + completion content (`$ai_input` / `$ai_output_choices`)\n * to the LLM-observability provider (→ `WILDO_LLM_OBS_CAPTURE_CONTENT`).\n * Default FALSE: content is user/app data (PII) shipped to a third party —\n * opt in per environment (local dev typically true; production a\n * deliberate decision).\n */\n captureContent: z.boolean().default(false),\n /**\n * Fraction (0..1) of agent calls forwarded (→ `WILDO_LLM_OBS_SAMPLE_RATE`).\n * Omitted = capture every call.\n */\n sampleRate: z.number().min(0).max(1).optional(),\n /**\n * NON-SECRET env for the selected LLM-observability provider — connection\n * details the provider module reads from the runtime env (e.g. PostHog's\n * `POSTHOG_HOST` ingestion host and `POSTHOG_PROJECT_ID`). Projected\n * verbatim into the runtime env; the env-key names are provider-owned,\n * same vocabulary as `secrets.json → providerEnv`. Secrets (API keys)\n * do NOT belong here — they stay in `secrets.json → providerEnv`, which\n * also WINS on a key collision (secrets are the more specific layer).\n * This is the checked-in home for provider config that is not sensitive.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n }).optional(),\n});\nexport type WildoObservabilityConfig = z.infer<typeof WildoObservabilityConfigSchema>;\n\n/**\n * Per-environment external-provider SELECTION override (2026-07-10).\n *\n * The app-wide primary/substitute selection for an `EngineCapability` lives in\n * `wildo.saas.config.ts` (`providers.scopes.backend.selection[capability]`) —\n * a single value shared by every environment. This block lets an environment\n * OVERRIDE that primary (and its substitutes) without touching the shared SaaS\n * config, so e.g. LOCAL can select the non-sending `email-preview` provider\n * for `EMAIL_TRANSACTIONAL` while staging/production keep `resend`.\n *\n * Semantics (mirrors the SaaS-side selection policy):\n * - `primary` — the ref that wins for this capability in this environment.\n * - `whenUnavailable` — ordered substitutes, used when a preceding ref is not AVAILABLE at\n * resolution time (undeclared, disabled, unconfigured). NOT failover: nothing retries a\n * second provider when a call to the first one fails.\n *\n * The referenced provider must still be DECLARED in\n * `providers.scopes.backend.providers` and available for the capability — the\n * backend's availability/enabled filtering is unchanged, so an override that\n * names an undeclared or capability-disabled provider resolves to nothing\n * (same fail-closed behaviour as an equivalent SaaS-side selection). FAN_OUT\n * capabilities ignore the override (every declared provider is active — a\n * primary/substitute is meaningless), matching the SaaS-side rule.\n *\n * `env-vars-builder` serializes this block to the `WILDO_PROVIDER_SELECTION_OVERRIDES`\n * backend env var (JSON); `ExternalProvidersRegistryBackendService` reads it and\n * applies it over the SaaS-config selection at capability-resolution time.\n * Persisted into `PlatformEnvConfigJson.providerSelection` and hydrated back by\n * `hydrateEnvironmentFromConfig`, mirroring `logging` / `observability`.\n */\nexport const WildoProviderSelectionOverrideEntrySchema = z.strictObject({\n primary: z.string().min(1),\n whenUnavailable: z.array(z.string().min(1)).optional(),\n});\nexport type WildoProviderSelectionOverrideEntry = z.infer<typeof WildoProviderSelectionOverrideEntrySchema>;\n\nexport const WildoProviderSelectionOverridesSchema = z.partialRecord(\n z.enum(EngineCapability),\n WildoProviderSelectionOverrideEntrySchema,\n);\nexport type WildoProviderSelectionOverrides = z.infer<typeof WildoProviderSelectionOverridesSchema>;\n\n/**\n * Per-environment provider CONFIGURATION values — the half of `providerConfigurations` that exists once per\n * DEPLOYMENT rather than once per application.\n *\n * `wildo.saas.config.ts > providerConfigurations` is authored once and reaches every environment. That is right for\n * application POLICY a provider reads (an agent execution profile, which environments it may run in). It is wrong\n * for an IDENTITY the vendor issued against one deployment: an OAuth client ID registered with the authorized\n * redirect URIs of one environment, a frontend SDK DSN or site key, a picker `appId`. Authored in the SaaS config, the\n * local development Google client — whose only redirect URI is `localhost` — would be the client staging and\n * production send users to.\n *\n * This block carries those values for ONE environment, in exactly the SaaS block's\n * `providerRef → protocolKind → key` shape, and {@link overlayEnvironmentProviderConfigurations} lays it over the\n * SaaS block KEY BY KEY. An environment therefore states only what differs and inherits the rest, so the policy half\n * is never restated per environment.\n *\n * It reaches both places a provider configuration is read, because the CLI applies the overlay where it knows the\n * environment: the managed declaration each environment's apps-manager stores (backend readers — the OAuth2\n * connection resolver, email/SMS senders, the provider registry) and the provider runtime artifacts a build bakes in\n * (frontend `publicConfig`, the backend's generated provider module).\n *\n * NOT for secrets. This file is committed; a client secret, API key or signing secret stays in\n * `secrets.json → providerEnv`. The CLI refuses a key named like one of the provider's declared secrets.\n */\nexport const WildoEnvironmentProviderConfigurationsSchema = z.record(\n z.string().min(1),\n z.record(z.string().min(1), z.record(z.string().min(1), z.unknown())),\n);\nexport type WildoEnvironmentProviderConfigurations = z.infer<typeof WildoEnvironmentProviderConfigurationsSchema>;\n\n/**\n * The provider configuration ONE environment runs with: the application-level `providerConfigurations`, with the\n * environment's {@link WildoEnvironmentProviderConfigurationsSchema} values laid over it key by key.\n *\n * Precedence is per key inside one `providerRef → protocolKind` bag, and the environment wins — the more specific\n * layer, as `secrets.json → providerEnv` wins over `observability.llmObservability.providerEnv`. A bag the\n * environment does not mention is carried unchanged; a bag only the environment declares is added. Neither input is\n * mutated.\n *\n * Rejected: replacing a whole provider or protocol bag. That would force an environment to restate every\n * environment-invariant key it shares with the application (an agent execution profile beside a client ID), and a\n * restated copy is one that drifts from the original.\n *\n * Throws when the application layer holds a non-object at a protocol key the environment overlays: there is no key\n * to lay a value over, and silently replacing it would discard the application's value without saying so.\n */\nexport function overlayEnvironmentProviderConfigurations(\n applicationProviderConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>> | undefined,\n environmentProviderConfigurations: WildoEnvironmentProviderConfigurations | undefined,\n): Record<string, Record<string, unknown> | undefined> {\n const resolved: Record<string, Record<string, unknown> | undefined> = {};\n for (const [providerRef, protocols] of Object.entries(applicationProviderConfigurations ?? {})) {\n resolved[providerRef] = protocols === undefined ? undefined : { ...protocols };\n }\n for (const [providerRef, environmentProtocols] of Object.entries(environmentProviderConfigurations ?? {})) {\n const merged: Record<string, unknown> = { ...(resolved[providerRef] ?? {}) };\n for (const [protocolKind, environmentValues] of Object.entries(environmentProtocols)) {\n const applicationValues = merged[protocolKind];\n if (applicationValues !== undefined && (applicationValues === null || typeof applicationValues !== 'object' || Array.isArray(applicationValues))) {\n throw new Error(\n `providerConfigurations.${providerRef}.${protocolKind} is not an object in wildo.saas.config.ts, so the `\n + 'environment\\'s values for it cannot be laid over it key by key.',\n );\n }\n merged[protocolKind] = { ...(applicationValues as Record<string, unknown> | undefined), ...environmentValues };\n }\n resolved[providerRef] = merged;\n }\n return resolved;\n}\n\nexport enum DatabaseEngine {\n MONGODB = 'mongodb',\n POSTGRESQL = 'postgresql',\n}\n\n/**\n * The store an APPLICATION persists to when its environment authors no `applicationDatabase`.\n *\n * PostgreSQL — decided by Paul on 2026-09-24 (#1571), reversing 75cd1934f (\"absence means MongoDB\")\n * and restoring the rule of 2e0194c41. This is the ONLY place the answer is written. Every reader of\n * an application's engine goes through {@link resolveApplicationDatabaseEngine}, because the\n * 2026-09-15 incident was two readers answering silence differently: provisioning chose PostgreSQL,\n * the runtime chose MongoDB, Mongo provisioning was skipped, registration reported success, and the\n * application died at boot with `Command update requires authentication`.\n *\n * Distinct from the PLATFORM's own store (`database` in the infra config) and from the engine's\n * `DEFAULT_PERSISTENCE_ADAPTER` / `DATABASE_DEFAULT_ADAPTER` env default, which also governs\n * platform services and is not what this decides. The application never falls through to that env\n * default: the CLI writes the resolved adapter explicitly.\n */\nexport const DEFAULT_APPLICATION_DATABASE_ENGINE: DatabaseEngine = DatabaseEngine.POSTGRESQL;\n\n/**\n * The engine an application persists to: its authored `applicationDatabase.engine`, or\n * {@link DEFAULT_APPLICATION_DATABASE_ENGINE} when the environment authors none.\n *\n * Takes the declaration rather than a whole config so every carrier of it — the parsed infra config,\n * `config.json`, a bootstrap request — answers through the same function.\n */\nexport function resolveApplicationDatabaseEngine(applicationDatabase: { readonly engine?: DatabaseEngine } | undefined): DatabaseEngine {\n return applicationDatabase?.engine ?? DEFAULT_APPLICATION_DATABASE_ENGINE;\n}\n\nexport enum WildoImageTagStrategy {\n COMMIT_SHA = 'commit-sha',\n BRANCH_NAME = 'branch-name',\n SEMVER = 'semver',\n}\n\n/**\n * Docker Compose deployment — no scaling, no K8s-specific fields.\n */\nexport const DockerComposeDeploymentSchema = z.strictObject({\n branch: z.string().min(1),\n runtime: z.literal(WildoDeploymentRuntime.DOCKER_COMPOSE),\n imageTagStrategy: z.enum(WildoImageTagStrategy).default(WildoImageTagStrategy.COMMIT_SHA),\n});\n\n/**\n * Kubernetes deployment — branch, namespace and tagging.\n *\n * No `registry`: an environment's images live at `remoteProvider.registryEndpoint`, the registry every deploy\n * manifest pulls from and the deploy workflow pushes to. A separate field here could only repeat that value or\n * contradict it — and it did contradict it, sending CI pushes to GHCR while the cluster pulled from the endpoint\n * (#1165). Both deployment shapes are strict, so a leftover `registry` is refused rather than silently ignored.\n */\nexport const KubernetesDeploymentSchema = z.strictObject({\n branch: z.string().min(1),\n runtime: z.literal(WildoDeploymentRuntime.KUBERNETES),\n namespace: z.string().min(1).optional(),\n imageTagStrategy: z.enum(WildoImageTagStrategy).default(WildoImageTagStrategy.COMMIT_SHA),\n});\n\n/**\n * Deployment configuration for CI/CD pipeline integration.\n * Discriminated on `runtime`: the K8s-specific field (`namespace`)\n * is only available when `runtime` is `KUBERNETES`.\n */\nexport const WildoDeploymentConfigSchema = z.discriminatedUnion('runtime', [\n DockerComposeDeploymentSchema,\n KubernetesDeploymentSchema,\n]);\nexport type WildoDeploymentConfig = z.infer<typeof WildoDeploymentConfigSchema>;\n/** @wildo_source:part:end platform.config.environment.deployment */\n\n/**\n * Canonical namespace derivation for platform-managed application resources.\n *\n * Environment ids are part of the namespace because local and arbitrary remote\n * deployments must be isolated through generated names instead of hand-authored\n * checked-in values.\n */\nexport function buildApplicationNamespace(\n appSlug: string,\n environmentId: string,\n): string {\n const normalizedAppSlug = appSlug.trim();\n const normalizedEnvironmentId = environmentId.trim();\n\n if (!normalizedAppSlug) {\n throw new Error('appSlug is required to derive an application namespace');\n }\n if (!normalizedEnvironmentId) {\n throw new Error('environmentId is required to derive an application namespace');\n }\n\n return `${normalizedAppSlug}-${normalizedEnvironmentId}`;\n}\n\nexport function buildApplicationDatabaseUsername(\n appSlug: string,\n environmentId: string,\n): string {\n return `${buildApplicationNamespace(appSlug, environmentId)}_user`;\n}\n\n/**\n * Per-environment origins the DOCUMENTATION site must be built against.\n *\n * ## Why these are authored per environment rather than inferred\n *\n * A documentation bundle is STATIC: whatever origin it is built with is compiled into\n * the shipped JavaScript. The docs site deep-links anonymous readers into the SaaS app to\n * sign in, and exchanges a token against the backend, so a bundle built with the wrong\n * origin does not degrade — it silently points every reader at the wrong host.\n *\n * That is why `docusaurus.config.ts` refuses to complete a PRODUCTION build when these are\n * unset, and falls back to local defaults otherwise. The guard is correct; what was missing\n * was a declared source, so the values had to be remembered on a command line and were\n * therefore absent from every environment definition. Authoring them here puts them where\n * every other per-environment posture already lives, and `wildo config sync` carries them.\n *\n * Projected onto `WILDO_DOCS_API_BASE_URL`, `WILDO_DOCS_APP_URL` and\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` by `env-vars-builder`, mirroring `providerSelection`.\n *\n * Every member is optional: an application with no documentation site authors nothing, and\n * a local environment relies on the config's own dev defaults rather than restating ports\n * that the runtime already knows.\n */\nexport const WildoDocumentationSiteConfigSchema = z.object({\n /**\n * Backend origin the docs bundle calls for `/auth/token/exchange` and\n * `/auth/cross-frontend-handoff` — e.g. `https://api.example.com`.\n */\n apiBaseUrl: z.string().trim().min(1).optional(),\n /**\n * SaaS application origin the docs site deep-links anonymous readers to for sign-in —\n * e.g. `https://app.example.com`.\n */\n appUrl: z.string().trim().min(1).optional(),\n /**\n * Frontend service name the docs site identifies as when resolving its own providers.\n * Must match the service key declared in `wildo.saas.config.ts#frontendServices`.\n */\n frontendServiceName: z.string().trim().min(1).optional(),\n});\n\nexport type WildoDocumentationSiteConfig = z.infer<typeof WildoDocumentationSiteConfigSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"environment.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/environment.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;AAC3B,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CACJ,4BAA4B,EAC5B,wFAAwF,CACzF,CAAC;AAGJ;;;;;GAKG;AACH,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,2DAAiC,CAAA;IACjC,mDAAyB,CAAA;AAC3B,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,UAAU,oBAAoB,CAAC,aAAqB;IACxD,OAAO,aAAa,KAAK,gBAAgB,CAAC,KAAK,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAN,IAAY,qBA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oEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAe,EACf,aAAqB;IAErB,MAAM,iBAAiB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,uBAAuB,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;IAErD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,GAAG,iBAAiB,IAAI,uBAAuB,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,OAAe,EACf,aAAqB;IAErB,OAAO,GAAG,yBAAyB,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C;;;OAGG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C;;;OAGG;IACH,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { refuseModuleOwnedProviderConfigurationKeys } from '@wildo-ai/external-connectors-models';\nimport { InfraServiceK8sSchema } from './infra-service.schemas';\n\n/**\n * @wildo_source:part:start platform.config.environment.deployment facet:layer:platform facet:family:infra\n *\n * Convenience environment ids kept for common local/staging/production setups.\n *\n * The project model is no longer limited to a fixed environment set: remote\n * environment ids can be any slug-like value. Use `WildoEnvironmentIdSchema`\n * for authoritative validation.\n */\nexport enum WildoEnvironment {\n LOCAL = 'local',\n STAGING = 'staging',\n PRODUCTION = 'production',\n}\n\nexport const WildoEnvironmentIdSchema = z\n .string()\n .min(1)\n .regex(\n /^[a-z0-9]+(?:-[a-z0-9]+)*$/,\n 'environment ids must be lowercase alphanumeric with optional hyphen-separated segments',\n );\nexport type WildoEnvironmentId = z.infer<typeof WildoEnvironmentIdSchema>;\n\n/**\n * Deployment runtime targets for CI/CD workflows and infra config.\n *\n * Single source of truth for deployment runtime targets, used by both\n * platform-config-lib (developer-facing config) and wildo-cli (operational).\n */\nexport enum WildoDeploymentRuntime {\n DOCKER_COMPOSE = 'docker-compose',\n KUBERNETES = 'kubernetes',\n}\n\nexport enum WildoLocationType {\n LOCAL = 'local',\n REMOTE = 'remote',\n}\n\nexport function isLocalEnvironmentId(environmentId: string): boolean {\n return environmentId === WildoEnvironment.LOCAL;\n}\n\n/**\n * Where a docker-compose backing service keeps its DATA.\n *\n * The two members are not a performance knob with a fast and a slow setting — they answer a\n * question about ownership, and the cost follows from the answer:\n *\n * - `HOST_PATH` — the data lives at an explicit path on the host\n * (`<saas-root>/.wildo-saas/local_data/<service>/`), bind-mounted into the container. The\n * operator chooses the disk, backups target a known directory, and the tree is the same one the\n * Kind k8s lane hostPath-mounts at `/mnt/local-data/<service>/`. That control is why it is the\n * REMOTE default: a production operator who has provisioned a dedicated data volume must be able\n * to put the database on it, and a named volume would silently land it under\n * `/var/lib/docker/volumes/` on the root disk.\n * - `DOCKER_VOLUME` — the data lives in a Docker named volume, inside the container runtime's own\n * storage. Nobody outside Docker addresses it, which is exactly what makes it right for a\n * disposable development stack.\n *\n * ## Why LOCAL defaults to `DOCKER_VOLUME`\n *\n * On Linux a bind mount is a native path and costs nothing. On macOS and Windows the container\n * runtime is a VM, and a host bind mount crosses a filesystem bridge — VirtioFS on macOS, 9p/\n * VirtioFS through WSL2 on Windows. Databases do small fsync'd random writes, so every one of them\n * becomes a round trip out of the VM.\n *\n * Measured on macOS (Apple Virtualization, 6 vCPU) on 2026-09-22 with the eight self-hosted backing\n * services bind-mounted: the VM process held **13,786 host file descriptors** open across 14,168\n * files and burned **383% CPU** in Docker Desktop's file-sharing process — sustained, a 321%\n * average over 2 days 5 hours — while the containers themselves used 0.7 of a core and container\n * block-IO accounting stayed flat, because none of that traffic reaches the VM's own block device.\n * Roughly four cores of pure filesystem translation for 0.7 of a core of database work.\n *\n * The default is uniform across all three development operating systems rather than \"volumes on\n * macOS and Windows, host paths on Linux\", so every developer and CI run exercise the same stack\n * and a bug reproduces the same way everywhere. It costs a Linux developer nothing: a named volume\n * is a native directory there too.\n *\n * Both members are authorable per environment (`localDataStorage`), so a remote operator who wants\n * volumes and a local developer who wants to read the files from their file manager each say so.\n *\n * NOTE this governs DATA directories only. The two small secret FILES compose mounts read-only —\n * immudb's state-signing key and mongot's sync-source password — are materialized from\n * `secrets.json` onto the host and stay host mounts under every mode. They are read once at\n * startup, so they carry none of the cost above, and they have nowhere else to come from.\n */\nexport enum WildoLocalDataStorage {\n DOCKER_VOLUME = 'docker-volume',\n HOST_PATH = 'host-path',\n}\n\n/**\n * The `localDataStorage` an environment gets when it authors none.\n *\n * Total over {@link WildoLocationType} rather than a conditional on one member, so a location type\n * added to the vocabulary tomorrow is a compile error here instead of silently inheriting whichever\n * branch happened to be the `else`.\n */\nexport function resolveDefaultLocalDataStorage(locationType: WildoLocationType): WildoLocalDataStorage {\n switch (locationType) {\n case WildoLocationType.LOCAL:\n return WildoLocalDataStorage.DOCKER_VOLUME;\n case WildoLocationType.REMOTE:\n return WildoLocalDataStorage.HOST_PATH;\n }\n}\n\n/**\n * Ingress controller installed by Wildo's local and remote Kubernetes workflows.\n * Import from `@wildo-ai/platform-config-lib`. Traefik owns both application\n * routing and HTTP-01 challenge routing; selecting another controller is not\n * supported by the generated installation contract.\n */\nexport enum WildoKubernetesIngressClass {\n TRAEFIK = 'traefik',\n}\n\n/**\n * K8s-internal cluster topology. Holds ONLY values that are genuinely\n * specific to a Kubernetes deployment: namespace, ingress class and\n * per-service workload replica counts.\n *\n * The external/public hostname (where browsers and reverse proxies hit\n * us) is NOT here — it lives at the top level of `WildoInfraEnvConfig`\n * as `publicDomain` because it applies to BOTH `KUBERNETES` and\n * `DOCKER_COMPOSE` runtimes. See `external-public-domain-rename.md`\n * for the rationale (the previous `baseDomain` field on this object\n * conflated K8s-internal and reverse-proxy concerns).\n */\nexport const WildoKubernetesConfigSchema = z.object({\n namespace: z.string().min(1),\n /**\n * Workload replica overrides keyed by authored SaaS service key (for example\n * backendApi, app or website), never by generated image/deployment name.\n * Platform service keys have their own renderer. Worker replicas remain in\n * the worker declaration; a key without a generated application target is\n * reported by application deployment generation rather than guessed.\n */\n services: z.record(z.string(), InfraServiceK8sSchema).optional(),\n // Derive the literal from the named runtime vocabulary while accepting the\n // natural authored spelling `ingressClass: 'traefik'` without an enum import.\n ingressClass: z.literal(`${WildoKubernetesIngressClass.TRAEFIK}`, {\n error: 'Wildo Kubernetes deployments support ingressClass traefik only; omit the field or select traefik.',\n }).optional(),\n});\nexport type WildoKubernetesConfig = z.infer<typeof WildoKubernetesConfigSchema>;\n\n/**\n * cert-manager `ClusterIssuer` selection for remote TLS. Both issuers are\n * always provisioned in the cluster (see `cluster-issuer.yaml.hbs`); this\n * picks which one an application's ingress annotation\n * (`cert-manager.io/cluster-issuer`) points at — i.e. which ACME endpoint\n * issues its per-ingress certificate.\n *\n * - `LETSENCRYPT_PROD` — real, browser-trusted certificates. The default,\n * because a remote deployment implies a real domain that browsers must\n * trust. Subject to Let's Encrypt production rate limits\n * (50 certs / registered domain / week).\n * - `LETSENCRYPT_STAGING` — untrusted test certificates with far higher\n * rate limits. Opt into this **while validating DNS + ingress on a new\n * cluster** so a misconfigured first deploy cannot exhaust the prod\n * quota, then flip to prod once issuance succeeds.\n */\nexport enum WildoTlsIssuer {\n LETSENCRYPT_PROD = 'letsencrypt-prod',\n LETSENCRYPT_STAGING = 'letsencrypt-staging',\n}\n\nexport const WildoRemoteProviderSchema = z.object({\n provider: z.string().min(1),\n registryEndpoint: z.string().min(1),\n region: z.string().min(1).optional(),\n /**\n * ACME registration email for Let's Encrypt (`ClusterIssuer.spec.acme.email`).\n * Optional at the schema level so non-TLS remote configs parse, but a\n * remote Kubernetes environment that terminates TLS should author it —\n * Let's Encrypt uses it for expiry warnings and account recovery.\n */\n acmeEmail: z.email().optional(),\n /**\n * Which cert-manager `ClusterIssuer` this environment's ingresses use.\n * Defaults to `LETSENCRYPT_PROD` downstream when unset. See {@link WildoTlsIssuer}.\n */\n tlsIssuer: z.enum(WildoTlsIssuer).optional(),\n});\nexport type WildoRemoteProvider = z.infer<typeof WildoRemoteProviderSchema>;\n\nexport const WildoLoggingConfigSchema = z.object({\n level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),\n formattedConsoleErrors: z.boolean().optional(),\n});\nexport type WildoLoggingConfig = z.infer<typeof WildoLoggingConfigSchema>;\n\n/**\n * Per-environment OTLP telemetry (traces + metrics + logs) posture (Slice 2 Phase 5).\n *\n * `env-vars-builder` projects this block onto the standard `OTEL_*` env vars that the\n * `otel-preload.ts` SDK (in `saas-backend-lib`) reads BEFORE app code:\n * - `enabled` → `OTEL_ENABLED` (the master gate) + drives the `--import` preload wiring.\n * - `endpoint` → `OTEL_EXPORTER_OTLP_ENDPOINT` (the OTLP/HTTP collector/ingest URL).\n * The provider auth header (`OTEL_EXPORTER_OTLP_HEADERS`) is NOT authored here — it is\n * derived by `env-vars-builder` from the selected `OBSERVABILITY_TELEMETRY` provider's\n * secret (e.g. a BetterStack source token). Persisted into `PlatformEnvConfigJson.observability`\n * and hydrated back by `hydrateEnvironmentFromConfig`, mirroring `logging`.\n */\nexport const WildoObservabilityConfigSchema = z.object({\n /**\n * Master switch for OTLP telemetry. `true` → emit `OTEL_ENABLED=true` + wire the\n * `--import @wildo-ai/saas-backend-lib/otel-preload` preload; the preload starts the SDK.\n * `false`/omitted → a complete no-op (the preload self-gates).\n */\n enabled: z.boolean().default(false),\n /**\n * OTLP/HTTP endpoint (`OTEL_EXPORTER_OTLP_ENDPOINT`). Local dev: the local `otel-collector`\n * (`http://localhost:4318`). Remote: the selected provider's ingesting host (e.g. a BetterStack\n * source URL). When omitted, the OTLP exporters fall back to their own default\n * (`http://localhost:4318`), which is the local collector — convenient for local dev.\n */\n endpoint: z.string().optional(),\n /**\n * LLM-call observability env-layer posture — a SEPARATE signal from OTLP\n * telemetry (fed by the engine `AgentCallTraceSink` into the selected\n * `LLM_OBSERVABILITY` provider, e.g. PostHog `$ai_generation`), colocated\n * here because both are per-environment observability posture. Projected\n * onto the `WILDO_LLM_OBS_*` env vars INDEPENDENTLY of the OTLP `enabled`\n * gate — LLM-obs activation is provider-selection-driven, not\n * `OTEL_ENABLED`-driven.\n */\n llmObservability: z.object({\n /**\n * Forward prompt + completion content (`$ai_input` / `$ai_output_choices`)\n * to the LLM-observability provider (→ `WILDO_LLM_OBS_CAPTURE_CONTENT`).\n * Default FALSE: content is user/app data (PII) shipped to a third party —\n * opt in per environment (local dev typically true; production a\n * deliberate decision).\n */\n captureContent: z.boolean().default(false),\n /**\n * Fraction (0..1) of agent calls forwarded (→ `WILDO_LLM_OBS_SAMPLE_RATE`).\n * Omitted = capture every call.\n */\n sampleRate: z.number().min(0).max(1).optional(),\n /**\n * NON-SECRET env for the selected LLM-observability provider — connection\n * details the provider module reads from the runtime env (e.g. PostHog's\n * `POSTHOG_HOST` ingestion host and `POSTHOG_PROJECT_ID`). Projected\n * verbatim into the runtime env; the env-key names are provider-owned,\n * same vocabulary as `secrets.json → providerEnv`. Secrets (API keys)\n * do NOT belong here — they stay in `secrets.json → providerEnv`, which\n * also WINS on a key collision (secrets are the more specific layer).\n * This is the checked-in home for provider config that is not sensitive.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n }).optional(),\n});\nexport type WildoObservabilityConfig = z.infer<typeof WildoObservabilityConfigSchema>;\n\n/**\n * Per-environment external-provider SELECTION override (2026-07-10).\n *\n * The app-wide primary/substitute selection for an `EngineCapability` lives in\n * `wildo.saas.config.ts` (`providers.scopes.backend.selection[capability]`) —\n * a single value shared by every environment. This block lets an environment\n * OVERRIDE that primary (and its substitutes) without touching the shared SaaS\n * config, so e.g. LOCAL can select the non-sending `email-preview` provider\n * for `EMAIL_TRANSACTIONAL` while staging/production keep `resend`.\n *\n * Semantics (mirrors the SaaS-side selection policy):\n * - `primary` — the ref that wins for this capability in this environment.\n * - `whenUnavailable` — ordered substitutes, used when a preceding ref is not AVAILABLE at\n * resolution time (undeclared, disabled, unconfigured). NOT failover: nothing retries a\n * second provider when a call to the first one fails.\n *\n * The referenced provider must still be DECLARED in\n * `providers.scopes.backend.providers` and available for the capability — the\n * backend's availability/enabled filtering is unchanged, so an override that\n * names an undeclared or capability-disabled provider resolves to nothing\n * (same fail-closed behaviour as an equivalent SaaS-side selection). FAN_OUT\n * capabilities ignore the override (every declared provider is active — a\n * primary/substitute is meaningless), matching the SaaS-side rule.\n *\n * `env-vars-builder` serializes this block to the `WILDO_PROVIDER_SELECTION_OVERRIDES`\n * backend env var (JSON); `ExternalProvidersRegistryBackendService` reads it and\n * applies it over the SaaS-config selection at capability-resolution time.\n * Persisted into `PlatformEnvConfigJson.providerSelection` and hydrated back by\n * `hydrateEnvironmentFromConfig`, mirroring `logging` / `observability`.\n */\nexport const WildoProviderSelectionOverrideEntrySchema = z.strictObject({\n primary: z.string().min(1),\n whenUnavailable: z.array(z.string().min(1)).optional(),\n});\nexport type WildoProviderSelectionOverrideEntry = z.infer<typeof WildoProviderSelectionOverrideEntrySchema>;\n\nexport const WildoProviderSelectionOverridesSchema = z.partialRecord(\n z.enum(EngineCapability),\n WildoProviderSelectionOverrideEntrySchema,\n);\nexport type WildoProviderSelectionOverrides = z.infer<typeof WildoProviderSelectionOverridesSchema>;\n\n/**\n * Per-environment provider CONFIGURATION values — the half of `providerConfigurations` that exists once per\n * DEPLOYMENT rather than once per application.\n *\n * `wildo.saas.config.ts > providerConfigurations` is authored once and reaches every environment. That is right for\n * application POLICY a provider reads (an agent execution profile, which environments it may run in). It is wrong\n * for an IDENTITY the vendor issued against one deployment: an OAuth client ID registered with the authorized\n * redirect URIs of one environment, a frontend SDK DSN or site key, a picker `appId`. Authored in the SaaS config, the\n * local development Google client — whose only redirect URI is `localhost` — would be the client staging and\n * production send users to.\n *\n * This block carries those values for ONE environment, in exactly the SaaS block's\n * `providerRef → protocolKind → key` shape, and {@link overlayEnvironmentProviderConfigurations} lays it over the\n * SaaS block KEY BY KEY. An environment therefore states only what differs and inherits the rest, so the policy half\n * is never restated per environment.\n *\n * The second level is a protocol kind for what a RUNTIME reads, and may also be a key the provider MODULE owns and\n * reads itself: `registration`, the vendor-side settings its `vendorRegistration` builds from (a Slack app's slash\n * commands, a Teams package's version), read only by `wildo providers register` (#2661, #2663). No runtime reader\n * looks it up, since each reads its own protocol kind, so it travels unused beside them; it lives here so that an\n * environment can lay its own registration over the application's, like any other value.\n *\n * It reaches both places a provider configuration is read, because the CLI applies the overlay where it knows the\n * environment: the managed declaration each environment's apps-manager stores (backend readers — the OAuth2\n * connection resolver, email/SMS senders, the provider registry) and the provider runtime artifacts a build bakes in\n * (frontend `publicConfig`, the backend's generated provider module).\n *\n * NOT for secrets. This file is committed; a client secret, API key or signing secret stays in\n * `secrets.json → providerEnv`. The CLI refuses a key named like one of the provider's declared secrets.\n */\nexport const WildoEnvironmentProviderConfigurationsSchema = z.record(\n z.string().min(1),\n z.record(z.string().min(1), z.record(z.string().min(1), z.unknown())),\n // Never a provider module's own keys (#2995): an environment cannot rewrite where a provider sends its credential any\n // more than the application can. A local double is reached through the environment-gated loopback host instead.\n).superRefine(refuseModuleOwnedProviderConfigurationKeys);\nexport type WildoEnvironmentProviderConfigurations = z.infer<typeof WildoEnvironmentProviderConfigurationsSchema>;\n\n/**\n * The provider configuration ONE environment runs with: the application-level `providerConfigurations`, with the\n * environment's {@link WildoEnvironmentProviderConfigurationsSchema} values laid over it key by key.\n *\n * Precedence is per key inside one `providerRef → protocolKind` bag, and the environment wins — the more specific\n * layer, as `secrets.json → providerEnv` wins over `observability.llmObservability.providerEnv`. A bag the\n * environment does not mention is carried unchanged; a bag only the environment declares is added. Neither input is\n * mutated.\n *\n * Rejected: replacing a whole provider or protocol bag. That would force an environment to restate every\n * environment-invariant key it shares with the application (an agent execution profile beside a client ID), and a\n * restated copy is one that drifts from the original.\n *\n * Throws when the application layer holds a non-object at a protocol key the environment overlays: there is no key\n * to lay a value over, and silently replacing it would discard the application's value without saying so.\n */\nexport function overlayEnvironmentProviderConfigurations(\n applicationProviderConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>> | undefined,\n environmentProviderConfigurations: WildoEnvironmentProviderConfigurations | undefined,\n): Record<string, Record<string, unknown> | undefined> {\n const resolved: Record<string, Record<string, unknown> | undefined> = {};\n for (const [providerRef, protocols] of Object.entries(applicationProviderConfigurations ?? {})) {\n resolved[providerRef] = protocols === undefined ? undefined : { ...protocols };\n }\n for (const [providerRef, environmentProtocols] of Object.entries(environmentProviderConfigurations ?? {})) {\n const merged: Record<string, unknown> = { ...(resolved[providerRef] ?? {}) };\n for (const [protocolKind, environmentValues] of Object.entries(environmentProtocols)) {\n const applicationValues = merged[protocolKind];\n if (applicationValues !== undefined && (applicationValues === null || typeof applicationValues !== 'object' || Array.isArray(applicationValues))) {\n throw new Error(\n `providerConfigurations.${providerRef}.${protocolKind} is not an object in wildo.saas.config.ts, so the `\n + 'environment\\'s values for it cannot be laid over it key by key.',\n );\n }\n merged[protocolKind] = { ...(applicationValues as Record<string, unknown> | undefined), ...environmentValues };\n }\n resolved[providerRef] = merged;\n }\n return resolved;\n}\n\nexport enum DatabaseEngine {\n MONGODB = 'mongodb',\n POSTGRESQL = 'postgresql',\n}\n\n/**\n * The store an APPLICATION persists to when its environment authors no `applicationDatabase`.\n *\n * PostgreSQL — decided by Paul on 2026-09-24 (#1571), reversing 75cd1934f (\"absence means MongoDB\")\n * and restoring the rule of 2e0194c41. This is the ONLY place the answer is written. Every reader of\n * an application's engine goes through {@link resolveApplicationDatabaseEngine}, because the\n * 2026-09-15 incident was two readers answering silence differently: provisioning chose PostgreSQL,\n * the runtime chose MongoDB, Mongo provisioning was skipped, registration reported success, and the\n * application died at boot with `Command update requires authentication`.\n *\n * Distinct from the PLATFORM's own store (`database` in the infra config) and from the engine's\n * `DEFAULT_PERSISTENCE_ADAPTER` / `DATABASE_DEFAULT_ADAPTER` env default, which also governs\n * platform services and is not what this decides. The application never falls through to that env\n * default: the CLI writes the resolved adapter explicitly.\n */\nexport const DEFAULT_APPLICATION_DATABASE_ENGINE: DatabaseEngine = DatabaseEngine.POSTGRESQL;\n\n/**\n * The engine an application persists to: its authored `applicationDatabase.engine`, or\n * {@link DEFAULT_APPLICATION_DATABASE_ENGINE} when the environment authors none.\n *\n * Takes the declaration rather than a whole config so every carrier of it — the parsed infra config,\n * `config.json`, a bootstrap request — answers through the same function.\n */\nexport function resolveApplicationDatabaseEngine(applicationDatabase: { readonly engine?: DatabaseEngine } | undefined): DatabaseEngine {\n return applicationDatabase?.engine ?? DEFAULT_APPLICATION_DATABASE_ENGINE;\n}\n\nexport enum WildoImageTagStrategy {\n COMMIT_SHA = 'commit-sha',\n BRANCH_NAME = 'branch-name',\n SEMVER = 'semver',\n}\n\n/**\n * Docker Compose deployment — no scaling, no K8s-specific fields.\n */\nexport const DockerComposeDeploymentSchema = z.strictObject({\n branch: z.string().min(1),\n runtime: z.literal(WildoDeploymentRuntime.DOCKER_COMPOSE),\n imageTagStrategy: z.enum(WildoImageTagStrategy).default(WildoImageTagStrategy.COMMIT_SHA),\n});\n\n/**\n * Kubernetes deployment — branch, namespace and tagging.\n *\n * No `registry`: an environment's images live at `remoteProvider.registryEndpoint`, the registry every deploy\n * manifest pulls from and the deploy workflow pushes to. A separate field here could only repeat that value or\n * contradict it — and it did contradict it, sending CI pushes to GHCR while the cluster pulled from the endpoint\n * (#1165). Both deployment shapes are strict, so a leftover `registry` is refused rather than silently ignored.\n */\nexport const KubernetesDeploymentSchema = z.strictObject({\n branch: z.string().min(1),\n runtime: z.literal(WildoDeploymentRuntime.KUBERNETES),\n namespace: z.string().min(1).optional(),\n imageTagStrategy: z.enum(WildoImageTagStrategy).default(WildoImageTagStrategy.COMMIT_SHA),\n});\n\n/**\n * Deployment configuration for CI/CD pipeline integration.\n * Discriminated on `runtime`: the K8s-specific field (`namespace`)\n * is only available when `runtime` is `KUBERNETES`.\n */\nexport const WildoDeploymentConfigSchema = z.discriminatedUnion('runtime', [\n DockerComposeDeploymentSchema,\n KubernetesDeploymentSchema,\n]);\nexport type WildoDeploymentConfig = z.infer<typeof WildoDeploymentConfigSchema>;\n/** @wildo_source:part:end platform.config.environment.deployment */\n\n/**\n * Canonical namespace derivation for platform-managed application resources.\n *\n * Environment ids are part of the namespace because local and arbitrary remote\n * deployments must be isolated through generated names instead of hand-authored\n * checked-in values.\n */\nexport function buildApplicationNamespace(\n appSlug: string,\n environmentId: string,\n): string {\n const normalizedAppSlug = appSlug.trim();\n const normalizedEnvironmentId = environmentId.trim();\n\n if (!normalizedAppSlug) {\n throw new Error('appSlug is required to derive an application namespace');\n }\n if (!normalizedEnvironmentId) {\n throw new Error('environmentId is required to derive an application namespace');\n }\n\n return `${normalizedAppSlug}-${normalizedEnvironmentId}`;\n}\n\nexport function buildApplicationDatabaseUsername(\n appSlug: string,\n environmentId: string,\n): string {\n return `${buildApplicationNamespace(appSlug, environmentId)}_user`;\n}\n\n/**\n * Per-environment origins the DOCUMENTATION site must be built against.\n *\n * ## Why these are authored per environment rather than inferred\n *\n * A documentation bundle is STATIC: whatever origin it is built with is compiled into\n * the shipped JavaScript. The docs site deep-links anonymous readers into the SaaS app to\n * sign in, and exchanges a token against the backend, so a bundle built with the wrong\n * origin does not degrade — it silently points every reader at the wrong host.\n *\n * That is why `docusaurus.config.ts` refuses to complete a PRODUCTION build when these are\n * unset, and falls back to local defaults otherwise. The guard is correct; what was missing\n * was a declared source, so the values had to be remembered on a command line and were\n * therefore absent from every environment definition. Authoring them here puts them where\n * every other per-environment posture already lives, and `wildo config sync` carries them.\n *\n * Projected onto `WILDO_DOCS_API_BASE_URL`, `WILDO_DOCS_APP_URL` and\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` by `env-vars-builder`, mirroring `providerSelection`.\n *\n * Every member is optional: an application with no documentation site authors nothing, and\n * a local environment relies on the config's own dev defaults rather than restating ports\n * that the runtime already knows.\n */\nexport const WildoDocumentationSiteConfigSchema = z.object({\n /**\n * Backend origin the docs bundle calls for `/auth/token/exchange` and\n * `/auth/cross-frontend-handoff` — e.g. `https://api.example.com`.\n */\n apiBaseUrl: z.string().trim().min(1).optional(),\n /**\n * SaaS application origin the docs site deep-links anonymous readers to for sign-in —\n * e.g. `https://app.example.com`.\n */\n appUrl: z.string().trim().min(1).optional(),\n /**\n * Frontend service name the docs site identifies as when resolving its own providers.\n * Must match the service key declared in `wildo.saas.config.ts#frontendServices`.\n */\n frontendServiceName: z.string().trim().min(1).optional(),\n});\n\nexport type WildoDocumentationSiteConfig = z.infer<typeof WildoDocumentationSiteConfigSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructure-defaults.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"infrastructure-defaults.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CA8BtB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB;;;CAGzB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,EAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,sCAAsC,EAAG,UAAmB,CAAC"}
|
|
@@ -30,6 +30,9 @@ export const INFRA_DEFAULT_PORTS = {
|
|
|
30
30
|
MONGOT_GRPC: 27028,
|
|
31
31
|
MONGOT_HEALTH: 8080,
|
|
32
32
|
MONGOT_METRICS: 9946,
|
|
33
|
+
// #2933 — the self-hosted OpenBao that holds the platform's custodied keys: Vault's API port. Only apps-manager dials
|
|
34
|
+
// it; the compose lane publishes it on the host solely because a framework developer's apps-manager runs there.
|
|
35
|
+
OPENBAO: 8200,
|
|
33
36
|
};
|
|
34
37
|
export const PLATFORM_DEFAULT_PORTS = {
|
|
35
38
|
APPS_MANAGER: 5151,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructure-defaults.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,mBAAmB,EAAE,KAAK;IAC1B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,oEAAoE;IACpE,mEAAmE;IACnE,yEAAyE;IACzE,MAAM,EAAE,IAAI;IACZ,oEAAoE;IACpE,4EAA4E;IAC5E,MAAM,EAAE,IAAI;IACZ,iFAAiF;IACjF,iFAAiF;IACjF,+EAA+E;IAC/E,kFAAkF;IAClF,8EAA8E;IAC9E,sEAAsE;IACtE,wEAAwE;IACxE,sDAAsD;IACtD,gFAAgF;IAChF,gFAAgF;IAChF,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"infrastructure-defaults.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/infrastructure-defaults.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,mBAAmB,EAAE,KAAK;IAC1B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,oEAAoE;IACpE,mEAAmE;IACnE,yEAAyE;IACzE,MAAM,EAAE,IAAI;IACZ,oEAAoE;IACpE,4EAA4E;IAC5E,MAAM,EAAE,IAAI;IACZ,iFAAiF;IACjF,iFAAiF;IACjF,+EAA+E;IAC/E,kFAAkF;IAClF,8EAA8E;IAC9E,sEAAsE;IACtE,wEAAwE;IACxE,sDAAsD;IACtD,gFAAgF;IAChF,gFAAgF;IAChF,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,sHAAsH;IACtH,gHAAgH;IAChH,OAAO,EAAE,IAAI;CACL,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,IAAI;IAClB,wBAAwB,EAAE,IAAI;IAC9B,eAAe,EAAE,IAAI;CACb,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,gBAAgB;CACrB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,WAAW;CAClB,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,IAAI;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,OAAO;CACT,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,UAAmB,CAAC","sourcesContent":["/**\n * Infrastructure default ports and constants.\n * Single source of truth — CLI catalogs, apps-manager env schemas,\n * and generated manifests all derive from these values.\n */\n\nexport const INFRA_DEFAULT_PORTS = {\n MONGODB: 27017,\n VALKEY: 6379,\n RABBITMQ: 5672,\n RABBITMQ_MANAGEMENT: 15672,\n MINIO: 9000,\n POSTGRESQL: 5432,\n // Slice 4 (4.8) — ClamAV catalog integration. 3310 is the canonical\n // clamd TCP port the official `clamav/clamav:1.4` image listens on\n // (and the port the static docker-compose.yml has been hand-publishing).\n CLAMAV: 3310,\n // Audit Phase 2 — immudb gRPC port (the canonical port the official\n // `codenotary/immudb` image listens on for the tamper-evident audit store).\n IMMUDB: 3322,\n // Issue #74 — `mongot`, the separate MongoDB Search / Vector Search process that\n // sits BESIDE mongod (never in front of it: clients only ever connect to mongod,\n // which routes `$search` / `$vectorSearch` to mongot over gRPC and lets mongot\n // read its change stream back). Three listeners, all container-internal — none is\n // ever published to the host, because nothing on the host is a mongot client.\n // - 27028 gRPC — the mongod ⇄ mongot channel (`mongotHost`).\n // - 8080 health — `GET /health` answers `{\"status\":\"SERVING\"}`.\n // - 9946 metrics — Prometheus scrape endpoint.\n // Verified 2026-08-27 against `mongodb/mongodb-community-search:1.70.3` running\n // beside `mongo:8.2` (8.2.12): index create + `$vectorSearch` query round-trip.\n MONGOT_GRPC: 27028,\n MONGOT_HEALTH: 8080,\n MONGOT_METRICS: 9946,\n // #2933 — the self-hosted OpenBao that holds the platform's custodied keys: Vault's API port. Only apps-manager dials\n // it; the compose lane publishes it on the host solely because a framework developer's apps-manager runs there.\n OPENBAO: 8200,\n} as const;\n\nexport const PLATFORM_DEFAULT_PORTS = {\n APPS_MANAGER: 5151,\n CRONTABS_BATCHES_MANAGER: 5152,\n MODULE_REGISTRY: 5154,\n} as const;\n\nexport const K8S_LOCAL_DEFAULTS = {\n NAMESPACE: 'wildo-local',\n BASE_DOMAIN: 'local.wildo.ai',\n} as const;\n\n/**\n * Write-time defaults for the runtime-agnostic top-level `publicDomain`\n * field on `WildoInfraEnvConfig`. Consumed ONLY by `wildo init` (and\n * the equivalent CLI bootstrap surface) to populate the generated\n * config file at creation time.\n *\n * There is no read-time fallback — the schema requires `publicDomain`\n * to be authored explicitly. A hand-edited config that drops the field\n * fails Zod parse with a clear error instead of silently defaulting.\n *\n * - `LOCAL_K8S` — what `wildo init` writes for a local K8s runtime.\n * - `LOCAL_COMPOSE` — what `wildo init` writes for a local Docker\n * Compose runtime (compose-without-reverse-proxy authors `'localhost'`).\n *\n * For remote envs, no default — the author must specify the apex\n * (e.g. `'wonder-todos.com'`).\n */\nexport const PUBLIC_DOMAIN_DEFAULTS = {\n LOCAL_K8S: 'local.wildo.ai',\n LOCAL_COMPOSE: 'localhost',\n} as const;\n\nexport const KIND_CLUSTER_DEFAULTS = {\n CLUSTER_NAME: 'dev',\n KUBECTL_CONTEXT: 'kind-dev',\n REGISTRY_NAME: 'kind-registry',\n REGISTRY_PORT: 5001,\n} as const;\n\nexport const STORAGE_DEFAULTS = {\n BUCKET: 'wildo-files',\n PROVIDER: 'minio',\n} as const;\n\n/**\n * Platform MongoDB database name.\n * This is the database used by apps-manager and platform services for\n * all platform-scoped collections (wildoApplication, platformApplications, etc.).\n * Aligned with PostgreSQL naming (`wildo_platform`).\n */\nexport const PLATFORM_MONGO_DATABASE = 'wildo_platform' as const;\n\n/**\n * Platform PostgreSQL database name — the PostgreSQL mirror of {@link PLATFORM_MONGO_DATABASE},\n * and it exists to keep the platform's own store SEPARATE from any application's.\n *\n * ⚠️ Do NOT derive this from `infrastructure.postgresql.database`. That field is mirrored from the\n * author's `backingServices.postgresql.database`, which names the APPLICATION's database (for\n * Wonder Todos local it is literally `wonder-todos-db`) and is also the compose container's initdb\n * database. Pointing the platform's `PG_CONNECT_URL` at it created the platform's ~94 tables —\n * `users`, `organizations`, `applications` among them — INSIDE the application's database; and\n * because every generated statement is `create table if not exists`, an application later\n * provisioning its own PostgreSQL schema there would silently ADOPT the platform's tables instead\n * of failing. Two tenancy planes, one table, no diagnostic. Found by review before the first flip.\n *\n * A dedicated name costs one `create database` — apps-manager INIT creates it through\n * `PostgreSQLConnectionManagerService.ensurePlatformDatabaseExists` using the `PG_ADMIN_*`\n * credentials, because PostgreSQL (unlike MongoDB) creates no database on connect and the compose\n * container's initdb creates only the application's. That makes the separation structural rather\n * than conventional. Full context: `.claude/plans/platform-postgresql-store-switch.md`.\n */\nexport const PLATFORM_POSTGRES_DATABASE = 'wildo_platform' as const;\n\n/**\n * The MAINTENANCE database the apps-manager admin pool connects to in order to provision OTHER\n * databases and roles — the value of `PG_ADMIN_DATABASE`.\n *\n * PostgreSQL has no \"connect to the server\" — every connection is to a database — while\n * `CREATE DATABASE` / `CREATE ROLE` are server-scoped and cannot run from inside the database being\n * created. So a provisioner needs one database that is guaranteed to exist and that it never\n * provisions: `postgres`, which `initdb` always creates alongside whatever `POSTGRES_DB` names.\n *\n * ⚠️ There are THREE PostgreSQL database names in this system and they are NOT interchangeable.\n * Conflating the first two cost a silent outage (2026-08-13):\n *\n * | Constant / field | Env key | Meaning |\n * |---|---|---|\n * | this one | `PG_ADMIN_DATABASE` | where the admin pool CONNECTS to do provisioning work |\n * | `infrastructure.postgresql.database` | `POSTGRES_ADMIN_DATABASE` | the container's `initdb` database (the APPLICATION's) |\n * | {@link PLATFORM_POSTGRES_DATABASE} | inside `PG_CONNECT_URL` | where the platform's OWN ~94 tables live |\n *\n * `PG_ADMIN_DATABASE` was emitted from `infrastructure.postgresql.database`, so the admin pool\n * dialled the APPLICATION's database (`wonder-todos-db`). That database is created by the compose\n * container's initdb — from the SEPARATE `POSTGRES_ADMIN_DATABASE` key, which defaults to\n * `wildo_platform` — so on any machine where the two disagreed it did not exist. The failure is\n * silent by construction: `3D000 database does not exist` is not a connection error, so\n * `initializeAdmin`'s retry branch is skipped, the caller records `postgresql: 'failed'` and\n * CONTINUES, and `/health/ready` still answers 200. `isPostgreSQLAvailable()` then returns false\n * for the whole process lifetime — every provisioning call a silent no-op behind a green probe.\n *\n * Pointing it at the application's database would be wrong even where that database exists: the\n * admin pool holds an open connection, and an open connection blocks `DROP DATABASE` on its own\n * target.\n *\n * A framework constant rather than an authored field on purpose — it is a property of PostgreSQL,\n * not of an environment. If a managed provider ever disallows connecting to `postgres`, this is the\n * single place to make it authorable; do not re-derive it from an application-scoped field.\n */\nexport const PLATFORM_POSTGRES_MAINTENANCE_DATABASE = 'postgres' as const;\n"]}
|
|
@@ -179,6 +179,10 @@ export declare function resolveGrantStorageNames(resourceTypes: readonly Resourc
|
|
|
179
179
|
* heartbeat and recovery update durable history, including after a restart.
|
|
180
180
|
* - **`JOB_PAYLOAD_STORAGE`, read/append.** Recovery retains completed output
|
|
181
181
|
* without granting the principal permission to rewrite or delete that output.
|
|
182
|
+
* - **`APPLICATION_DATA_KEYS`, read/maintain (#2894).** A minion opens the stored secrets the backend seals (a
|
|
183
|
+
* provider credential an agent calls with), so its data-key ring reads every WRAPPED data key at boot, and it
|
|
184
|
+
* reserves seals and issues a data key when it seals one itself. Unwrapping still needs the platform custodian,
|
|
185
|
+
* which admits only the runtimes the `sealed_secrets` purpose names; a wrapped key read here opens nothing alone.
|
|
182
186
|
*
|
|
183
187
|
* These framework operations bypass the in-process `resourceAccess` whitelist by construction —
|
|
184
188
|
* `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iCAAiC,EAEjC,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4CAA4C,EAAE,SAAS,MAAM,EACb,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC,IAAI,GAAG,iCAAiC,CAAC,KAAK,CAAC;IAChG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CAAC,cAAc,EAAE;IACjE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,6BAA6B,EAAE,CAyElC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,EAC3G,2BAA2B,GAAE,SAAS,MAAM,EAAO,GAClD,oBAAoB,GAAG,IAAI,CAuB7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAEzF;AAED
|
|
1
|
+
{"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iCAAiC,EAEjC,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4CAA4C,EAAE,SAAS,MAAM,EACb,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC,IAAI,GAAG,iCAAiC,CAAC,KAAK,CAAC;IAChG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CAAC,cAAc,EAAE;IACjE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,6BAA6B,EAAE,CAyElC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,oBAAoB;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