@wildo-ai/platform-config-lib 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +24 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +25 -0
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +117 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +63 -4
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +24 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +24 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts +37 -0
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js +43 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js +8 -4
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +36 -3
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js +36 -13
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts.map +1 -1
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
- package/dist/esm/lockfile/build-parallelism.js +64 -0
- package/dist/esm/lockfile/build-parallelism.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts +7 -1
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +17 -3
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +28 -7
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +24 -11
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +455 -6
- 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 -0
- 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 +13 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js +56 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -0
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts +886 -29
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +395 -16
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js +1 -2
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +142 -25
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +229 -26
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
- package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
- package/dist/esm/project-config/index.d.ts +6 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +6 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +35 -0
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +148 -8
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts +23 -0
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -0
- package/dist/esm/project-config/npm-version-range.js +175 -0
- package/dist/esm/project-config/npm-version-range.js.map +1 -0
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts +288 -30
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +795 -46
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +192 -20
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +381 -42
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js +14 -35
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.d.ts +157 -0
- package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -0
- package/dist/esm/project-config/shared/backing-service-servability.js +256 -0
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -0
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +66 -66
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +75 -67
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js +41 -2
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js +11 -12
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +186 -9
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +185 -10
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js +40 -3
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +77 -47
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +114 -52
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
- package/dist/esm/project-config/static-asset-import-noop.d.ts +26 -0
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -0
- package/dist/esm/project-config/static-asset-import-noop.js +49 -0
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -0
- package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/companion-api.schemas.d.ts +0 -176
- package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -1
- package/dist/esm/registry/companion-api.schemas.js.map +0 -1
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/index.d.ts +3 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js +3 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts +31 -0
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -0
- package/dist/esm/registry/local-checkout-source.js +45 -0
- package/dist/esm/registry/local-checkout-source.js.map +1 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +174 -14
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js +120 -11
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts +79 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js +36 -0
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +403 -23
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +502 -60
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts +80 -0
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -0
- package/dist/esm/registry/module-search.schemas.js +112 -0
- package/dist/esm/registry/module-search.schemas.js.map +1 -0
- package/dist/esm/registry/registry-config.schemas.d.ts +16 -0
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js +8 -0
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts +126 -2
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js +183 -14
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.d.ts +80 -0
- package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -0
- package/dist/esm/registry/registry-keys.schemas.js +68 -0
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +25 -3
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +17 -14
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js +8 -7
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/package.json +7 -7
- package/dist/esm/registry/companion-api.schemas.js +0 -165
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructure-defaults.schemas.js","sourceRoot":"","sources":["
|
|
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;CACZ,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} 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k8s-utils.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"k8s-utils.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/E;AAuBD,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAW9E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAE7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,6BAA6B,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAEhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k8s-utils.js","sourceRoot":"","sources":["../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,IAAY,EAAE,SAAiB;IAClF,OAAO,UAAU,OAAO,IAAI,SAAS,sBAAsB,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,GAAG,OAAO,IAAI,SAAS,oBAAoB,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,YAAoB;IACrE,OAAO,WAAW,OAAO,IAAI,YAAY,EAAE,CAAC;AAC9C,CAAC;AAgCD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAC1D,6EAA6E;IAC7E,8EAA8E;IAC9E,8EAA8E;IAC9E,4EAA4E;IAC5E,+EAA+E;IAC/E,4EAA4E;IAC5E,6CAA6C;IAC7C,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA+B;IACnE,OAAO,WAAW,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,OAAO,uBAAuB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,uBAAuB,CAAC,kBAA0B;IAChE,OAAO,GAAG,kBAAkB,SAAS,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,6BAA6B,CAAC,kBAA0B;IACtE,OAAO,GAAG,kBAAkB,mBAAmB,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Kubernetes URL builders and naming conventions.\n * Single source of truth for constructing K8s-style addresses and resource names.\n *\n * Used by CLI (ServiceAddressResolver, K8s manifest gen) and apps-manager\n * (application lifecycle) to ensure consistent URL/naming patterns.\n */\n\n/**\n * Builds a K8s cluster-internal URL: `http://<service>.<namespace>.svc.cluster.local:<port>`\n */\nexport function buildK8sInternalUrl(service: string, port: number, namespace: string): string {\n return `http://${service}.${namespace}.svc.cluster.local:${port}`;\n}\n\n/**\n * Builds a K8s cluster-internal hostname (without scheme/port).\n */\nexport function buildK8sInternalHost(service: string, namespace: string): string {\n return `${service}.${namespace}.svc.cluster.local`;\n}\n\n/**\n * Builds an ingress-based public URL: `https://<service>.<publicDomain>`\n *\n * `publicDomain` is the runtime-agnostic external hostname (browsers /\n * reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.\n *\n * Used for PLATFORM services (apps-manager, module-registry, …) whose\n * subdomain is always the service name. Application services (frontends +\n * backend API) resolve their public host through {@link buildServicePublicHost}\n * so the operator's authored `serviceHosts` map wins.\n */\nexport function buildK8sPublicUrl(service: string, publicDomain: string): string {\n return `https://${service}.${publicDomain}`;\n}\n\n// ============================================================================\n// Application public-host resolution (serviceHosts-driven)\n// ============================================================================\n//\n// Single source of truth for an application service's PUBLIC hostname, shared\n// by every producer so ingress routing, `runtime.endPoints[*].publicUrl`, and\n// CORS never diverge (a divergence breaks the browser's next `fetch` on CORS —\n// see `.claude/plans/self-host-domain-subdomain-model.md`).\n//\n// The self-hosted, single-app, mono-env model: each service lives at a\n// subdomain of the operator's own `publicDomain`. Greenfield — there is NO\n// multi-tenant `{service}-{appSlug}-{env}` fan-out.\n//\n// - `serviceHosts[serviceKey]` authored → `<host>.<publicDomain>`\n// (`app` → `app.example.com`), or `<publicDomain>` when the authored value\n// is the empty string (apex — `''` → `example.com`).\n// - key NOT authored → `<serviceKey>.<publicDomain>`: the service key IS its\n// own subdomain, the same convention platform services use via\n// {@link buildK8sPublicUrl}. A DEFINED fallback (never a silent error — the\n// `serviceHosts` schema requires consumers handle \"not mapped\" explicitly).\n\nexport interface ServicePublicHostParams {\n /** The application service key (`config.services.<key>` / `serviceHosts` key). */\n serviceKey: string;\n /** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */\n serviceHosts: Record<string, string> | undefined;\n /** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n}\n\n/**\n * Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`\n * wins; the service key is its own subdomain when unauthored; `''` = apex.\n * See the section header.\n */\nexport function buildServicePublicHost(params: ServicePublicHostParams): string {\n const { serviceKey, serviceHosts, publicDomain } = params;\n // Fallback uses the service key AS the subdomain, lowercased: DNS labels are\n // case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,\n // so a camelCase key like `backendApi` must become `backendapi` to round-trip\n // (and to match the ingress host). Authored serviceHosts values are already\n // lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with\n // a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator\n // must author a `serviceHosts` entry for it.\n const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();\n return host === '' ? publicDomain : `${host}.${publicDomain}`;\n}\n\n/**\n * Resolve an application service's PUBLIC URL (`https://<host>`), where the\n * host comes from {@link buildServicePublicHost}.\n */\nexport function buildServicePublicUrl(params: ServicePublicHostParams): string {\n return `https://${buildServicePublicHost(params)}`;\n}\n\n/**\n * K8s Secret name for a platform service: `<service>-secret`\n */\nexport function k8sServiceSecretName(service: string): string {\n return `${service}-secret`;\n}\n\n/**\n * K8s ConfigMap name for a platform service: `<service>-config`\n */\nexport function k8sServiceConfigMapName(service: string): string {\n return `${service}-config`;\n}\n\n/**\n * K8s Secret name for an app backend: `<serviceName>-secret`\n *\n * The emitted name MUST match the `envFrom: secretRef.name` the application\n * deployment template mounts. The CLI static emit lane\n * (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's\n * backend `serviceName`.\n *\n * The name-mismatch gap this JSDoc used to warn about is CLOSED (#377): the templates no longer\n * spell a Secret name at all — each receives the resolved `{{runtimeEnvSecretName}}` from\n * {@link k8sRuntimeEnvSecretName}, which is the same function the emit side calls. The mount stays\n * fail-closed (no `optional: true`), so were the two ever to diverge again the pod would refuse to\n * boot rather than start without its environment.\n *\n * ⚠️ Still true: the K8s app lane has never had a live cluster run. What is verified is that emit\n * and mount agree, pinned from both sides.\n *\n * Application backends emit a single Secret per app (no companion ConfigMap):\n * envFrom mounts every entry as `process.env.*`, so splitting sensitive vs\n * non-sensitive added zero runtime value and fragmented the canonical sink.\n * See `k8s-secrets-generator.service.ts` § 5 for the design note.\n */\nexport function k8sAppBackendSecretName(serviceName: string): string {\n return k8sRuntimeEnvSecretName(serviceName);\n}\n\n/**\n * K8s Secret name carrying ONE runtime's ENVIRONMENT: `<runtimeServiceName>-secret`.\n *\n * The companion of {@link k8sRuntimeProvidersSecretName} — that one carries a runtime's provider\n * CREDENTIALS, this one everything else it boots with. Same keying: the app slug for the backend\n * pod, {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker.\n *\n * ## Why minions and workers stopped sharing the backend's (issue #377)\n *\n * Every minion and worker pod used to `envFrom`-mount the BACKEND's `{appSlug}-secret`, so each\n * received the backend's whole environment: the platform bootstrap contract, MongoDB / PostgreSQL /\n * Redis / RabbitMQ topology, storage configuration — and, once #360 composed it, the backend's\n * `OTEL_EXPORTER_OTLP_HEADERS`, which carries the telemetry provider's token. So the per-runtime\n * confinement that #329, #360 and #369 established was defeated one level up: a minion scoped to\n * `openai` alone got no telemetry token in its own provider Secret and received it anyway, from a\n * different runtime's environment.\n *\n * `buildApplicationMinionEnv` and `buildApplicationWorkerEnv` already existed, already took a\n * `RuntimeProviderScope`, and already produced the correctly-scoped environment for the compose\n * lane. The Kubernetes lane simply never called them.\n *\n * ## Every mount name is now resolved here, including the backend's\n *\n * `k8sAppBackendSecretName` delegates rather than repeating `${x}-secret`, so there is ONE format\n * string for this concept. The templates receive the resolved name as `{{runtimeEnvSecretName}}`\n * and no longer compose `{{appName}}-secret` themselves — which is what the older JSDoc on\n * `k8sAppBackendSecretName` warned about, from the era when a template hardcoded a name the emit\n * never produced and the pod failed closed at boot.\n *\n * Unlike the provider Secret, this mount is NOT `optional`: a runtime cannot boot without its\n * environment, and a missing one must fail loudly rather than start a pod that cannot work.\n */\nexport function k8sRuntimeEnvSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-secret`;\n}\n\n/**\n * K8s Secret name carrying ONE runtime's provider credentials:\n * `<runtimeServiceName>-providers-secret`.\n *\n * `runtimeServiceName` is the runtime's own DNS name — the app slug for the backend pod,\n * {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker — so every\n * application runtime gets its own Secret and no two can collide.\n *\n * ## Why this replaced one shared `providers-secret` (issue #369)\n *\n * There used to be a single cluster-wide `providers-secret` holding the application's ENTIRE\n * `providerEnv`, `envFrom`-mounted by the backend, every minion AND every worker. `envFrom` merges,\n * so a provider key the per-app Secret withheld arrived from that second reference: on Kubernetes a\n * worker authoring `providers: {}` received every provider key the application had, in its process\n * environment, which is exactly what LLM-driven minion code reads. The per-runtime confinement\n * (#329) held in the compose lane and did not exist here at all — one contract, two deployment\n * lanes, one swept.\n *\n * **The name is a function, not a format string repeated in a template, and that is the point.**\n * This file already carries a scar from the other direction: `k8sAppBackendSecretName` documents a\n * mount whose name the template hardcodes, and a mismatch there means a pod that cannot boot. Here\n * the emit side (`k8s-secrets-generator.service.ts`) and the mount side (the three\n * `*.deployment.yaml.hbs` renderers) both call THIS function, and the templates receive the\n * resolved name as `{{providersSecretName}}` rather than composing it themselves.\n *\n * The mount stays `optional: true`: a runtime that declares no providers gets no Secret emitted,\n * which is the correct outcome and must not fail pod start.\n */\nexport function k8sRuntimeProvidersSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-providers-secret`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"k8s-utils.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,IAAY,EAAE,SAAiB;IAClF,OAAO,UAAU,OAAO,IAAI,SAAS,sBAAsB,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,GAAG,OAAO,IAAI,SAAS,oBAAoB,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,YAAoB;IACrE,OAAO,WAAW,OAAO,IAAI,YAAY,EAAE,CAAC;AAC9C,CAAC;AAgCD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAC1D,6EAA6E;IAC7E,8EAA8E;IAC9E,8EAA8E;IAC9E,4EAA4E;IAC5E,+EAA+E;IAC/E,4EAA4E;IAC5E,6CAA6C;IAC7C,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA+B;IACnE,OAAO,WAAW,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,OAAO,uBAAuB,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,uBAAuB,CAAC,kBAA0B;IAChE,OAAO,GAAG,kBAAkB,SAAS,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,6BAA6B,CAAC,kBAA0B;IACtE,OAAO,GAAG,kBAAkB,mBAAmB,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Kubernetes URL builders and naming conventions.\n * Single source of truth for constructing K8s-style addresses and resource names.\n *\n * Used by CLI (ServiceAddressResolver, K8s manifest gen) and apps-manager\n * (application lifecycle) to ensure consistent URL/naming patterns.\n */\n\n/**\n * Builds a K8s cluster-internal URL: `http://<service>.<namespace>.svc.cluster.local:<port>`\n */\nexport function buildK8sInternalUrl(service: string, port: number, namespace: string): string {\n return `http://${service}.${namespace}.svc.cluster.local:${port}`;\n}\n\n/**\n * Builds a K8s cluster-internal hostname (without scheme/port).\n */\nexport function buildK8sInternalHost(service: string, namespace: string): string {\n return `${service}.${namespace}.svc.cluster.local`;\n}\n\n/**\n * Builds an ingress-based public URL: `https://<service>.<publicDomain>`\n *\n * `publicDomain` is the runtime-agnostic external hostname (browsers /\n * reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.\n *\n * Used for PLATFORM services (apps-manager, module-registry, …) whose\n * subdomain is always the service name. Application services (frontends +\n * backend API) resolve their public host through {@link buildServicePublicHost}\n * so the operator's authored `serviceHosts` map wins.\n */\nexport function buildK8sPublicUrl(service: string, publicDomain: string): string {\n return `https://${service}.${publicDomain}`;\n}\n\n// ============================================================================\n// Application public-host resolution (serviceHosts-driven)\n// ============================================================================\n//\n// Single source of truth for an application service's PUBLIC hostname, shared\n// by every producer so ingress routing, `runtime.endPoints[*].publicUrl`, and\n// CORS never diverge (a divergence breaks the browser's next `fetch` on CORS —\n// see `.claude/plans/self-host-domain-subdomain-model.md`).\n//\n// The self-hosted, single-app, mono-env model: each service lives at a\n// subdomain of the operator's own `publicDomain`. Greenfield — there is NO\n// multi-tenant `{service}-{appSlug}-{env}` fan-out.\n//\n// - `serviceHosts[serviceKey]` authored → `<host>.<publicDomain>`\n// (`app` → `app.example.com`), or `<publicDomain>` when the authored value\n// is the empty string (apex — `''` → `example.com`).\n// - key NOT authored → `<serviceKey>.<publicDomain>`: the service key IS its\n// own subdomain, the same convention platform services use via\n// {@link buildK8sPublicUrl}. A DEFINED fallback (never a silent error — the\n// `serviceHosts` schema requires consumers handle \"not mapped\" explicitly).\n\nexport interface ServicePublicHostParams {\n /** The application service key (`config.services.<key>` / `serviceHosts` key). */\n serviceKey: string;\n /** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */\n serviceHosts: Record<string, string> | undefined;\n /** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n}\n\n/**\n * Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`\n * wins; the service key is its own subdomain when unauthored; `''` = apex.\n * See the section header.\n */\nexport function buildServicePublicHost(params: ServicePublicHostParams): string {\n const { serviceKey, serviceHosts, publicDomain } = params;\n // Fallback uses the service key AS the subdomain, lowercased: DNS labels are\n // case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,\n // so a camelCase key like `backendApi` must become `backendapi` to round-trip\n // (and to match the ingress host). Authored serviceHosts values are already\n // lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with\n // a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator\n // must author a `serviceHosts` entry for it.\n const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();\n return host === '' ? publicDomain : `${host}.${publicDomain}`;\n}\n\n/**\n * Resolve an application service's PUBLIC URL (`https://<host>`), where the\n * host comes from {@link buildServicePublicHost}.\n */\nexport function buildServicePublicUrl(params: ServicePublicHostParams): string {\n return `https://${buildServicePublicHost(params)}`;\n}\n\n/**\n * K8s Secret name for a platform service: `<service>-secret`\n */\nexport function k8sServiceSecretName(service: string): string {\n return `${service}-secret`;\n}\n\n/**\n * K8s ConfigMap name for a platform service: `<service>-config`\n */\nexport function k8sServiceConfigMapName(service: string): string {\n return `${service}-config`;\n}\n\n/**\n * K8s Secret name for an app backend: `<serviceName>-secret`\n *\n * The emitted name MUST match the `envFrom: secretRef.name` the application\n * deployment template mounts. The CLI static emit lane\n * (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's\n * backend `serviceName`.\n *\n * The name-mismatch gap this JSDoc used to warn about is CLOSED (#377): the templates no longer\n * spell a Secret name at all — each receives the resolved `{{runtimeEnvSecretName}}` from\n * {@link k8sRuntimeEnvSecretName}, which is the same function the emit side calls. The mount stays\n * fail-closed (no `optional: true`), so were the two ever to diverge again the pod would refuse to\n * boot rather than start without its environment.\n *\n * ⚠️ Still true: the K8s app lane has never had a live cluster run. What is verified is that emit\n * and mount agree, pinned from both sides.\n *\n * Application backends emit a single Secret per app (no companion ConfigMap):\n * envFrom mounts every entry as `process.env.*`, so splitting sensitive vs\n * non-sensitive added zero runtime value and fragmented the canonical sink.\n * See `k8s-secrets-generator.service.ts` § 5 for the design note.\n */\nexport function k8sAppBackendSecretName(serviceName: string): string {\n return k8sRuntimeEnvSecretName(serviceName);\n}\n\n/**\n * K8s Secret name carrying ONE runtime's ENVIRONMENT: `<runtimeServiceName>-secret`.\n *\n * The companion of {@link k8sRuntimeProvidersSecretName} — that one carries a runtime's provider\n * CREDENTIALS, this one everything else it boots with. Same keying: the app slug for the backend\n * pod, {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker.\n *\n * ## Why minions and workers stopped sharing the backend's (issue #377)\n *\n * Every minion and worker pod used to `envFrom`-mount the BACKEND's `{appSlug}-secret`, so each\n * received the backend's whole environment: the platform bootstrap contract, MongoDB / PostgreSQL /\n * Redis / RabbitMQ topology, storage configuration — and, once #360 composed it, the backend's\n * `OTEL_EXPORTER_OTLP_HEADERS`, which carries the telemetry provider's token. So the per-runtime\n * confinement that #329, #360 and #369 established was defeated one level up: a minion scoped to\n * `openai` alone got no telemetry token in its own provider Secret and received it anyway, from a\n * different runtime's environment.\n *\n * `buildApplicationMinionEnv` and `buildApplicationWorkerEnv` already existed, already took a\n * `RuntimeProviderScope`, and already produced the correctly-scoped environment for the compose\n * lane. The Kubernetes lane simply never called them.\n *\n * ## Every mount name is now resolved here, including the backend's\n *\n * `k8sAppBackendSecretName` delegates rather than repeating `${x}-secret`, so there is ONE format\n * string for this concept. The templates receive the resolved name as `{{runtimeEnvSecretName}}`\n * and no longer compose `{{appName}}-secret` themselves — which is what the older JSDoc on\n * `k8sAppBackendSecretName` warned about, from the era when a template hardcoded a name the emit\n * never produced and the pod failed closed at boot.\n *\n * Unlike the provider Secret, this mount is NOT `optional`: a runtime cannot boot without its\n * environment, and a missing one must fail loudly rather than start a pod that cannot work.\n */\nexport function k8sRuntimeEnvSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-secret`;\n}\n\n/**\n * K8s Secret name carrying ONE runtime's provider credentials:\n * `<runtimeServiceName>-providers-secret`.\n *\n * `runtimeServiceName` is the runtime's own DNS name — the app slug for the backend pod,\n * {@link buildMinionServiceName} / {@link buildWorkerServiceName} for a minion or worker — so every\n * application runtime gets its own Secret and no two can collide.\n *\n * ## Why this replaced one shared `providers-secret` (issue #369)\n *\n * There used to be a single cluster-wide `providers-secret` holding the application's ENTIRE\n * `providerEnv`, `envFrom`-mounted by the backend, every minion AND every worker. `envFrom` merges,\n * so a provider key the per-app Secret withheld arrived from that second reference: on Kubernetes a\n * worker authoring `providers: {}` received every provider key the application had, in its process\n * environment, which is exactly what LLM-driven minion code reads. The per-runtime confinement\n * (#329) held in the compose lane and did not exist here at all — one contract, two deployment\n * lanes, one swept.\n *\n * **The name is a function, not a format string repeated in a template, and that is the point.**\n * This file already carries a scar from the other direction: `k8sAppBackendSecretName` documents a\n * mount whose name the template hardcodes, and a mismatch there means a pod that cannot boot. Here\n * the emit side (`k8s-secrets-generator.service.ts`) and the mount side (the three\n * `*.deployment.yaml.hbs` renderers) both call THIS function, and the templates receive the\n * resolved name as `{{providersSecretName}}` rather than composing it themselves.\n *\n * The mount stays `optional: true`: a runtime that declares no providers gets no Secret emitted,\n * which is the correct outcome and must not fail pod start.\n */\nexport function k8sRuntimeProvidersSecretName(runtimeServiceName: string): string {\n return `${runtimeServiceName}-providers-secret`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minion-platform-access.vocabulary.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"minion-platform-access.vocabulary.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oBAAY,yBAAyB;IACnC;;;;OAIG;IACH,gBAAgB,qBAAqB;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minion-platform-access.vocabulary.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"minion-platform-access.vocabulary.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACnC;;;;OAIG;IACH,kEAAqC,CAAA;AACvC,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC","sourcesContent":["/**\n * The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).\n *\n * ## Why it lives under `project-config` and not beside its derivation\n *\n * The split is by AUDIENCE: the vocabulary an app author writes lives with the\n * other authoring vocabularies; {@link buildOwnCronRecordFilter} and the\n * declaration type stay in `bootstrap/`, because a runtime derivation is not\n * something an authored config should be reaching for.\n *\n * It first moved here for a worse reason, kept as history because the defect\n * shape recurred. Until 2026-09-09 the config loader resolved\n * `@wildo-ai/platform-config-lib` to a `config-authoring.entry.ts` that exported\n * `./project-config` and `./workspace-scope` and nothing else, so an app config\n * importing this enum from `bootstrap/` beside `AppFrontendType` — same package,\n * same statement — got `AppFrontendType` and `undefined` for this one, and\n * `wildo config sync` died on `reading 'OWN_CRON_RECORDS'`. Moving the enum cured\n * that name; the next symbol the engine composed at module load from the same\n * package hit the same wall. The entry now re-exports the whole root (see its\n * header), so placement under `project-config` is a statement about who authors\n * the value, no longer about what the loader can see.\n */\n\nexport enum MinionPlatformAccessScope {\n /**\n * The minion's OWN cron/schedule records. There is deliberately no\n * `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope\n * somebody will eventually grant.\n */\n OWN_CRON_RECORDS = 'own_cron_records',\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ResourceType } from '@wildo-ai/saas-models';
|
|
1
|
+
import { RuntimePrincipalDatabaseGrantAxis, type ResourceType } from '@wildo-ai/saas-models';
|
|
2
2
|
/**
|
|
3
3
|
* The two safety gates that must hold BEFORE a minion's `resourceAccess` may be
|
|
4
4
|
* turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).
|
|
@@ -9,52 +9,67 @@ import { type ResourceType } from '@wildo-ai/saas-models';
|
|
|
9
9
|
* alias map is exactly where it is not.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
* Resource types a minion may never declare (D15 / R11).
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* whole `users` collection — every user's
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
12
|
+
* Resource types a minion may never declare (D15 / R11) — every ALIASED door.
|
|
13
|
+
*
|
|
14
|
+
* An aliased door is a resource type whose rows live in ANOTHER resource type's
|
|
15
|
+
* collection (`RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES`). It is always the
|
|
16
|
+
* NARROWER of the two doors, and a database grant cannot be narrower than a
|
|
17
|
+
* collection — so a grant derived from the narrow door carries the wide one.
|
|
18
|
+
*
|
|
19
|
+
* The alias map holds two KINDS of narrow door, and both are refused for that
|
|
20
|
+
* same reason while differing in why they are narrow:
|
|
21
|
+
*
|
|
22
|
+
* - **self doors** (`USER_SELF`, `USER_SELF_PROFILES`, `USER_SELF_PREFERENCES`)
|
|
23
|
+
* address "MY row". They are additionally meaningless for a minion:
|
|
24
|
+
* `APPLICATION_MACHINE` carries no `userId`, so there is no row to be "mine".
|
|
25
|
+
* Declaring `USER_SELF` would grant the whole `users` collection — every user's
|
|
26
|
+
* row, through a door that promises one.
|
|
27
|
+
* - **subset doors** (`APPLICATION_AUDIT_LOGS`, #317) see a different SUBSET of a
|
|
28
|
+
* shared record set. The application audit door and the organization audit door
|
|
29
|
+
* read one trail; a grant derived from either carries the entire trail.
|
|
30
|
+
*
|
|
31
|
+
* This constant was named `MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES` while the
|
|
32
|
+
* map held only self doors, and kept that name — and a refusal message calling
|
|
33
|
+
* every entry a self door — after the audit door joined it (#458). The rule was
|
|
34
|
+
* never "self doors are forbidden"; it is "a grant must not be wider than the
|
|
35
|
+
* declaration reads", and the name now says that.
|
|
36
|
+
*
|
|
37
|
+
* Removing every aliased door from the declarable set is also what makes
|
|
38
|
+
* resource-type → collection INJECTIVE, so a grant derived per resource type means
|
|
39
|
+
* exactly what the author wrote. Relaxing it for convenience silently restores
|
|
40
|
+
* the coarser floor.
|
|
41
|
+
*
|
|
42
|
+
* Derived from the alias map rather than listed, so an alias added there is
|
|
43
|
+
* forbidden here on the same commit instead of quietly becoming declarable — and
|
|
44
|
+
* the pin in `minion-resource-access.validation.test.ts` forces that addition to
|
|
45
|
+
* be reviewed rather than absorbed.
|
|
31
46
|
*/
|
|
32
|
-
export declare const
|
|
47
|
+
export declare const MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES: readonly string[];
|
|
33
48
|
/** One reason a `resourceAccess` declaration cannot be turned into grants. */
|
|
34
49
|
export interface MinionResourceAccessViolation {
|
|
35
|
-
/**
|
|
36
|
-
readonly axis:
|
|
50
|
+
/** The AUTHORED axis the offending entry was declared on — `resourceAccess` has only these two. */
|
|
51
|
+
readonly axis: RuntimePrincipalDatabaseGrantAxis.READ | RuntimePrincipalDatabaseGrantAxis.WRITE;
|
|
37
52
|
readonly resourceType: string;
|
|
38
53
|
/** Operator-facing explanation naming the consequence and the fix. */
|
|
39
54
|
readonly message: string;
|
|
40
55
|
}
|
|
41
56
|
/**
|
|
42
|
-
* Reject
|
|
57
|
+
* Reject aliased-door types, and refuse any declaration whose types collapse onto
|
|
43
58
|
* one collection.
|
|
44
59
|
*
|
|
45
60
|
* Returns every violation rather than throwing on the first: an author fixing a
|
|
46
61
|
* config wants the whole list, and a caller that wants to fail closed can do so
|
|
47
62
|
* on a non-empty result.
|
|
48
63
|
*
|
|
49
|
-
* ## The injectivity check is NOT redundant with the
|
|
64
|
+
* ## The injectivity check is NOT redundant with the aliased-door rejection
|
|
50
65
|
*
|
|
51
|
-
* It is tempting to think removing the
|
|
66
|
+
* It is tempting to think removing the aliased doors makes collisions impossible —
|
|
52
67
|
* that is true of TODAY's alias map and is exactly why this must be checked
|
|
53
68
|
* rather than assumed. The alias map is data: a future entry that aliases two
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
69
|
+
* types a minion MAY declare onto one collection would reintroduce the collapse,
|
|
70
|
+
* and the grant derived for one type would silently carry the other's rows.
|
|
71
|
+
* Failing closed here makes that a build failure instead of a containment that
|
|
72
|
+
* quietly widened.
|
|
58
73
|
*/
|
|
59
74
|
export declare function findMinionResourceAccessViolations(resourceAccess: {
|
|
60
75
|
read?: readonly string[] | undefined;
|
|
@@ -81,10 +96,9 @@ export declare function findMinionResourceAccessViolations(resourceAccess: {
|
|
|
81
96
|
* thin adapter that speaks them.
|
|
82
97
|
*
|
|
83
98
|
* `null` means **no access was declared at all**, which is NOT the same as an
|
|
84
|
-
* empty declaration and must not be flattened into one. Absent ⇒
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* access, a different and legitimate statement. One "empty list" for both would
|
|
99
|
+
* empty declaration and must not be flattened into one. Absent ⇒ no authored business-data access. The database credential owner
|
|
100
|
+
* separately supplies the mandatory runtime floor; object storage must not receive
|
|
101
|
+
* that floor. Declared-but-empty remains an explicit author decision. One "empty list" for both would
|
|
88
102
|
* make "I forgot" indistinguishable from "I meant none".
|
|
89
103
|
*/
|
|
90
104
|
export interface MinionResourceGrants {
|
|
@@ -147,7 +161,7 @@ export declare function resolveGrantStorageNames(resourceTypes: readonly Resourc
|
|
|
147
161
|
* ## Why this is not declarable, and must not become so
|
|
148
162
|
*
|
|
149
163
|
* `resourceAccess` answers "what application data may this minion touch". These
|
|
150
|
-
*
|
|
164
|
+
* entries answer a different question: "what does the framework itself touch
|
|
151
165
|
* in order to run a repository operation at all". No author decides them, no
|
|
152
166
|
* author can opt out of them, and asking one to write them down would be asking
|
|
153
167
|
* a human for an answer the mechanism already knows — the exact shape
|
|
@@ -161,8 +175,12 @@ export declare function resolveGrantStorageNames(resourceTypes: readonly Resourc
|
|
|
161
175
|
* so it triggers this one before it ever reaches `todos`.
|
|
162
176
|
* - **`AUDIT_LOGS`, append.** `AuditLogsBackendService` writes one row per audited
|
|
163
177
|
* operation, including the `system_context_read` it emits for the read above.
|
|
178
|
+
* - **`JOB_EXECUTIONS`, read/maintain.** Scheduled receipt, atomic admission,
|
|
179
|
+
* heartbeat and recovery update durable history, including after a restart.
|
|
180
|
+
* - **`JOB_PAYLOAD_STORAGE`, read/append.** Recovery retains completed output
|
|
181
|
+
* without granting the principal permission to rewrite or delete that output.
|
|
164
182
|
*
|
|
165
|
-
*
|
|
183
|
+
* These framework operations bypass the in-process `resourceAccess` whitelist by construction —
|
|
166
184
|
* `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's
|
|
167
185
|
* SERVICES registry, and these go through the repositories registry — so the
|
|
168
186
|
* database grant was the only gate they ever met, and it refused them. That
|
|
@@ -177,25 +195,37 @@ export declare function resolveGrantStorageNames(resourceTypes: readonly Resourc
|
|
|
177
195
|
* audit trail a principal can delete is not an audit trail. The append axis exists
|
|
178
196
|
* so this floor can be satisfied without handing out that capability.
|
|
179
197
|
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
198
|
+
* ## What this does NOT cover
|
|
199
|
+
*
|
|
200
|
+
* Named runtime principals only. The APPLICATION BACKEND is issued a database-owning
|
|
201
|
+
* credential on every adapter (PostgreSQL `ALL PRIVILEGES`, MongoDB `readWrite` +
|
|
202
|
+
* `dbAdmin`, Atlas `readWrite`), so nothing at the database layer stops the backend's
|
|
203
|
+
* own credential from amending an audit row; for the backend, audit immutability is
|
|
204
|
+
* the application layer's — `AUDIT_LOGS` exposes no update or delete operation. And
|
|
205
|
+
* only the SELF-MANAGED adapters issue a per-principal credential at all.
|
|
206
|
+
*
|
|
207
|
+
* assurance-control: WILDO.AUDIT.TAMPER_RESISTANCE — a named runtime principal may add
|
|
208
|
+
* audit rows and may never modify or remove them, and may not be granted otherwise.
|
|
182
209
|
*/
|
|
183
210
|
export declare const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES: readonly ResourceType[];
|
|
184
|
-
/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only
|
|
211
|
+
/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only floor. */
|
|
185
212
|
export declare const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES: readonly ResourceType[];
|
|
213
|
+
/** Insert and update durable execution state, without permission to erase its history. */
|
|
214
|
+
export declare const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES: readonly ResourceType[];
|
|
186
215
|
/**
|
|
187
216
|
* A minion's grants as a DATABASE role must hold them: what the author declared,
|
|
188
|
-
* plus the engine floor above
|
|
217
|
+
* plus the engine floor above — one resource-type list per
|
|
218
|
+
* {@link RuntimePrincipalDatabaseGrantAxis}, whose members document each axis's verbs.
|
|
219
|
+
*
|
|
220
|
+
* Mapped over the axis vocabulary rather than spelled out, so an axis added there is a compile error
|
|
221
|
+
* at every site that builds or consumes one of these until it is handled.
|
|
189
222
|
*
|
|
190
|
-
*
|
|
223
|
+
* Separate append and maintain axes keep the floor honest — see
|
|
191
224
|
* {@link MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES}.
|
|
192
225
|
*/
|
|
193
|
-
export
|
|
194
|
-
readonly
|
|
195
|
-
|
|
196
|
-
/** Insert-only. Never update, never delete. */
|
|
197
|
-
readonly append: readonly ResourceType[];
|
|
198
|
-
}
|
|
226
|
+
export type MinionDatabaseGrants = {
|
|
227
|
+
readonly [Axis in RuntimePrincipalDatabaseGrantAxis]: readonly ResourceType[];
|
|
228
|
+
};
|
|
199
229
|
/**
|
|
200
230
|
* Add the engine floor to an authored derivation — the ONE place database grants
|
|
201
231
|
* acquire it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,2CAA2C,EAAE,SAAS,YAAY,EAC8D,CAAC;AAE9I,gFAAgF;AAChF,eAAO,MAAM,6CAA6C,EAAE,SAAS,YAAY,EAC0B,CAAC;AAE5G,0FAA0F;AAC1F,eAAO,MAAM,+CAA+C,EAAE,SAAS,YAAY,EACV,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,IAAI,IAAI,iCAAiC,GAAG,SAAS,YAAY,EAAE;CAC9E,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CA4B7F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreResourceType, RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES, resolveSharedPersistenceCollectionName, } from '@wildo-ai/saas-models';
|
|
1
|
+
import { CoreResourceType, RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES, RuntimePrincipalDatabaseGrantAxis, resolveSharedPersistenceCollectionName, } from '@wildo-ai/saas-models';
|
|
2
2
|
/**
|
|
3
3
|
* The two safety gates that must hold BEFORE a minion's `resourceAccess` may be
|
|
4
4
|
* turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).
|
|
@@ -9,63 +9,102 @@ import { CoreResourceType, RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES, resol
|
|
|
9
9
|
* alias map is exactly where it is not.
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
* Resource types a minion may never declare (D15 / R11).
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* whole `users` collection — every user's
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
12
|
+
* Resource types a minion may never declare (D15 / R11) — every ALIASED door.
|
|
13
|
+
*
|
|
14
|
+
* An aliased door is a resource type whose rows live in ANOTHER resource type's
|
|
15
|
+
* collection (`RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES`). It is always the
|
|
16
|
+
* NARROWER of the two doors, and a database grant cannot be narrower than a
|
|
17
|
+
* collection — so a grant derived from the narrow door carries the wide one.
|
|
18
|
+
*
|
|
19
|
+
* The alias map holds two KINDS of narrow door, and both are refused for that
|
|
20
|
+
* same reason while differing in why they are narrow:
|
|
21
|
+
*
|
|
22
|
+
* - **self doors** (`USER_SELF`, `USER_SELF_PROFILES`, `USER_SELF_PREFERENCES`)
|
|
23
|
+
* address "MY row". They are additionally meaningless for a minion:
|
|
24
|
+
* `APPLICATION_MACHINE` carries no `userId`, so there is no row to be "mine".
|
|
25
|
+
* Declaring `USER_SELF` would grant the whole `users` collection — every user's
|
|
26
|
+
* row, through a door that promises one.
|
|
27
|
+
* - **subset doors** (`APPLICATION_AUDIT_LOGS`, #317) see a different SUBSET of a
|
|
28
|
+
* shared record set. The application audit door and the organization audit door
|
|
29
|
+
* read one trail; a grant derived from either carries the entire trail.
|
|
30
|
+
*
|
|
31
|
+
* This constant was named `MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES` while the
|
|
32
|
+
* map held only self doors, and kept that name — and a refusal message calling
|
|
33
|
+
* every entry a self door — after the audit door joined it (#458). The rule was
|
|
34
|
+
* never "self doors are forbidden"; it is "a grant must not be wider than the
|
|
35
|
+
* declaration reads", and the name now says that.
|
|
36
|
+
*
|
|
37
|
+
* Removing every aliased door from the declarable set is also what makes
|
|
38
|
+
* resource-type → collection INJECTIVE, so a grant derived per resource type means
|
|
39
|
+
* exactly what the author wrote. Relaxing it for convenience silently restores
|
|
40
|
+
* the coarser floor.
|
|
41
|
+
*
|
|
42
|
+
* Derived from the alias map rather than listed, so an alias added there is
|
|
43
|
+
* forbidden here on the same commit instead of quietly becoming declarable — and
|
|
44
|
+
* the pin in `minion-resource-access.validation.test.ts` forces that addition to
|
|
45
|
+
* be reviewed rather than absorbed.
|
|
31
46
|
*/
|
|
32
|
-
export const
|
|
47
|
+
export const MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES = Object.keys(RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES);
|
|
33
48
|
/**
|
|
34
|
-
* Reject
|
|
49
|
+
* Reject aliased-door types, and refuse any declaration whose types collapse onto
|
|
35
50
|
* one collection.
|
|
36
51
|
*
|
|
37
52
|
* Returns every violation rather than throwing on the first: an author fixing a
|
|
38
53
|
* config wants the whole list, and a caller that wants to fail closed can do so
|
|
39
54
|
* on a non-empty result.
|
|
40
55
|
*
|
|
41
|
-
* ## The injectivity check is NOT redundant with the
|
|
56
|
+
* ## The injectivity check is NOT redundant with the aliased-door rejection
|
|
42
57
|
*
|
|
43
|
-
* It is tempting to think removing the
|
|
58
|
+
* It is tempting to think removing the aliased doors makes collisions impossible —
|
|
44
59
|
* that is true of TODAY's alias map and is exactly why this must be checked
|
|
45
60
|
* rather than assumed. The alias map is data: a future entry that aliases two
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
61
|
+
* types a minion MAY declare onto one collection would reintroduce the collapse,
|
|
62
|
+
* and the grant derived for one type would silently carry the other's rows.
|
|
63
|
+
* Failing closed here makes that a build failure instead of a containment that
|
|
64
|
+
* quietly widened.
|
|
50
65
|
*/
|
|
51
66
|
export function findMinionResourceAccessViolations(resourceAccess) {
|
|
52
67
|
const violations = [];
|
|
53
68
|
const axes = [
|
|
54
|
-
[
|
|
55
|
-
[
|
|
69
|
+
[RuntimePrincipalDatabaseGrantAxis.READ, resourceAccess.read ?? []],
|
|
70
|
+
[RuntimePrincipalDatabaseGrantAxis.WRITE, resourceAccess.write ?? []],
|
|
56
71
|
];
|
|
72
|
+
// An APPEND-ONLY floor entry may not be widened to WRITE by declaration. Refused here, at parse
|
|
73
|
+
// time, rather than honoured downstream: the write axis carries DELETE, so `write: ['auditLogs']`
|
|
74
|
+
// is not a broader version of the audit floor — it is the one grant that lets a principal remove
|
|
75
|
+
// the evidence of what it did. This used to be permitted as "an explicit, reviewed decision", and
|
|
76
|
+
// the grant derivation kept the declared axis; but a declaration nobody is forced to justify is not
|
|
77
|
+
// a review, and the property the append axis exists for held only until somebody typed one word.
|
|
78
|
+
// Derived from the floor itself, so a type added to the append floor tomorrow is refused on write
|
|
79
|
+
// on the same commit.
|
|
80
|
+
for (const resourceType of resourceAccess.write ?? []) {
|
|
81
|
+
if (MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES.includes(resourceType)) {
|
|
82
|
+
violations.push({
|
|
83
|
+
axis: RuntimePrincipalDatabaseGrantAxis.WRITE,
|
|
84
|
+
resourceType,
|
|
85
|
+
message: `'${resourceType}' cannot be declared on a minion's write axis: the engine already grants it APPEND-only `
|
|
86
|
+
+ '(insert, never update or delete), and a write grant would let this minion modify or remove rows it '
|
|
87
|
+
+ 'appended — for the audit trail, the evidence of its own actions. Remove it from `write`; appending '
|
|
88
|
+
+ 'needs no declaration.',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
57
92
|
for (const [axis, declared] of axes) {
|
|
58
93
|
for (const resourceType of declared) {
|
|
59
|
-
if (
|
|
94
|
+
if (MINION_FORBIDDEN_ALIASED_DOOR_RESOURCE_TYPES.includes(resourceType)) {
|
|
95
|
+
// The message names only what is true of EVERY aliased door: the collection
|
|
96
|
+
// it shares and the wider type that owns it. An earlier message called each
|
|
97
|
+
// entry a "SELF door … every user's row", which was false for the audit door.
|
|
98
|
+
const widerResourceType = RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES[resourceType];
|
|
99
|
+
const collection = resolveSharedPersistenceCollectionName(resourceType);
|
|
60
100
|
violations.push({
|
|
61
101
|
axis,
|
|
62
102
|
resourceType,
|
|
63
|
-
message: `'${resourceType}' is
|
|
64
|
-
+ '
|
|
65
|
-
+ `
|
|
66
|
-
+ `'${
|
|
67
|
-
+ '
|
|
68
|
-
+ 'type explicitly if the minion genuinely needs that breadth.',
|
|
103
|
+
message: `'${resourceType}' is an ALIASED door and cannot be granted to a minion (D15): its rows live in the `
|
|
104
|
+
+ `'${collection}' collection it shares with '${widerResourceType}'. A database grant is issued per `
|
|
105
|
+
+ `collection, so granting '${resourceType}' would reach every row '${widerResourceType}' addresses — `
|
|
106
|
+
+ `wider than the door '${resourceType}' promises. Declare '${widerResourceType}' explicitly if the `
|
|
107
|
+
+ 'minion genuinely needs that breadth.',
|
|
69
108
|
});
|
|
70
109
|
}
|
|
71
110
|
}
|
|
@@ -164,7 +203,7 @@ export function resolveGrantStorageNames(resourceTypes) {
|
|
|
164
203
|
* ## Why this is not declarable, and must not become so
|
|
165
204
|
*
|
|
166
205
|
* `resourceAccess` answers "what application data may this minion touch". These
|
|
167
|
-
*
|
|
206
|
+
* entries answer a different question: "what does the framework itself touch
|
|
168
207
|
* in order to run a repository operation at all". No author decides them, no
|
|
169
208
|
* author can opt out of them, and asking one to write them down would be asking
|
|
170
209
|
* a human for an answer the mechanism already knows — the exact shape
|
|
@@ -178,8 +217,12 @@ export function resolveGrantStorageNames(resourceTypes) {
|
|
|
178
217
|
* so it triggers this one before it ever reaches `todos`.
|
|
179
218
|
* - **`AUDIT_LOGS`, append.** `AuditLogsBackendService` writes one row per audited
|
|
180
219
|
* operation, including the `system_context_read` it emits for the read above.
|
|
220
|
+
* - **`JOB_EXECUTIONS`, read/maintain.** Scheduled receipt, atomic admission,
|
|
221
|
+
* heartbeat and recovery update durable history, including after a restart.
|
|
222
|
+
* - **`JOB_PAYLOAD_STORAGE`, read/append.** Recovery retains completed output
|
|
223
|
+
* without granting the principal permission to rewrite or delete that output.
|
|
181
224
|
*
|
|
182
|
-
*
|
|
225
|
+
* These framework operations bypass the in-process `resourceAccess` whitelist by construction —
|
|
183
226
|
* `MinionScopedServicesRegistryHandlerBackendService` decorates the minion's
|
|
184
227
|
* SERVICES registry, and these go through the repositories registry — so the
|
|
185
228
|
* database grant was the only gate they ever met, and it refused them. That
|
|
@@ -194,12 +237,23 @@ export function resolveGrantStorageNames(resourceTypes) {
|
|
|
194
237
|
* audit trail a principal can delete is not an audit trail. The append axis exists
|
|
195
238
|
* so this floor can be satisfied without handing out that capability.
|
|
196
239
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
240
|
+
* ## What this does NOT cover
|
|
241
|
+
*
|
|
242
|
+
* Named runtime principals only. The APPLICATION BACKEND is issued a database-owning
|
|
243
|
+
* credential on every adapter (PostgreSQL `ALL PRIVILEGES`, MongoDB `readWrite` +
|
|
244
|
+
* `dbAdmin`, Atlas `readWrite`), so nothing at the database layer stops the backend's
|
|
245
|
+
* own credential from amending an audit row; for the backend, audit immutability is
|
|
246
|
+
* the application layer's — `AUDIT_LOGS` exposes no update or delete operation. And
|
|
247
|
+
* only the SELF-MANAGED adapters issue a per-principal credential at all.
|
|
248
|
+
*
|
|
249
|
+
* assurance-control: WILDO.AUDIT.TAMPER_RESISTANCE — a named runtime principal may add
|
|
250
|
+
* audit rows and may never modify or remove them, and may not be granted otherwise.
|
|
199
251
|
*/
|
|
200
|
-
export const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES = [CoreResourceType.APPLICATION];
|
|
201
|
-
/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only
|
|
202
|
-
export const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES = [CoreResourceType.AUDIT_LOGS];
|
|
252
|
+
export const MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES = [CoreResourceType.APPLICATION, CoreResourceType.JOB_EXECUTIONS, CoreResourceType.JOB_PAYLOAD_STORAGE];
|
|
253
|
+
/** @see MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES — the append-only floor. */
|
|
254
|
+
export const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES = [CoreResourceType.AUDIT_LOGS, CoreResourceType.JOB_PAYLOAD_STORAGE];
|
|
255
|
+
/** Insert and update durable execution state, without permission to erase its history. */
|
|
256
|
+
export const MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES = [CoreResourceType.JOB_EXECUTIONS];
|
|
203
257
|
/**
|
|
204
258
|
* Add the engine floor to an authored derivation — the ONE place database grants
|
|
205
259
|
* acquire it.
|
|
@@ -220,15 +274,23 @@ export const MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES = [CoreResourceType.A
|
|
|
220
274
|
*/
|
|
221
275
|
export function deriveMinionDatabaseGrants(grants) {
|
|
222
276
|
const normalize = (resourceTypes) => [...new Set(resourceTypes)].sort();
|
|
223
|
-
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
|
|
277
|
+
const declaredWrite = new Set(grants.write);
|
|
278
|
+
// Fail closed on an append-only floor entry that arrived on the write axis. The parse-time gate in
|
|
279
|
+
// `findMinionResourceAccessViolations` refuses the declaration; reaching here with one means that
|
|
280
|
+
// gate was bypassed (a hand-built grant object), and honouring it would mint the one credential the
|
|
281
|
+
// append axis exists to withhold.
|
|
282
|
+
const widenedAppendFloor = MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES.filter((resourceType) => declaredWrite.has(resourceType));
|
|
283
|
+
if (widenedAppendFloor.length > 0) {
|
|
284
|
+
throw new Error(`Refusing to derive minion database grants that put append-only resource types on the write axis: `
|
|
285
|
+
+ `${widenedAppendFloor.join(', ')}. A write grant carries DELETE; these are granted APPEND only.`);
|
|
286
|
+
}
|
|
228
287
|
return {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
288
|
+
[RuntimePrincipalDatabaseGrantAxis.READ]: normalize([...grants.read, ...MINION_ENGINE_MANDATORY_READ_RESOURCE_TYPES]),
|
|
289
|
+
[RuntimePrincipalDatabaseGrantAxis.WRITE]: normalize(grants.write),
|
|
290
|
+
[RuntimePrincipalDatabaseGrantAxis.APPEND]: normalize(MINION_ENGINE_MANDATORY_APPEND_RESOURCE_TYPES),
|
|
291
|
+
// A MAINTAIN floor entry the author also declared on write keeps the wider axis: runtime state is
|
|
292
|
+
// not evidence, so the append-floor refusal above deliberately does not extend to it.
|
|
293
|
+
[RuntimePrincipalDatabaseGrantAxis.MAINTAIN]: normalize(MINION_ENGINE_MANDATORY_MAINTAIN_RESOURCE_TYPES.filter((resourceType) => !declaredWrite.has(resourceType))),
|
|
232
294
|
};
|
|
233
295
|
}
|
|
234
296
|
//# sourceMappingURL=minion-resource-access.validation.js.map
|