@wildo-ai/platform-config-lib 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +23 -1
  2. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.contracts.js +24 -0
  4. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +150 -1
  6. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.js +124 -4
  8. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  9. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +16 -0
  10. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +28 -0
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  13. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
  14. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
  16. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  17. package/dist/esm/index.d.ts +1 -0
  18. package/dist/esm/index.d.ts.map +1 -1
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
  22. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
  23. package/dist/esm/lockfile/build-parallelism.js +64 -0
  24. package/dist/esm/lockfile/build-parallelism.js.map +1 -0
  25. package/dist/esm/lockfile/materialize-infra-section.d.ts +1 -1
  26. package/dist/esm/lockfile/materialize-infra-section.js +1 -1
  27. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  28. package/dist/esm/project-config/define-infra-env-config.d.ts +899 -15
  29. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  30. package/dist/esm/project-config/define-infra-env-config.js +397 -16
  31. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  32. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  33. package/dist/esm/project-config/define-minion-config.js +1 -2
  34. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  35. package/dist/esm/project-config/define-saas-config.d.ts +90 -25
  36. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  37. package/dist/esm/project-config/define-saas-config.js +165 -12
  38. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  39. package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
  40. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
  41. package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
  42. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
  43. package/dist/esm/project-config/index.d.ts +3 -0
  44. package/dist/esm/project-config/index.d.ts.map +1 -1
  45. package/dist/esm/project-config/index.js +3 -0
  46. package/dist/esm/project-config/index.js.map +1 -1
  47. package/dist/esm/project-config/loader.d.ts +24 -0
  48. package/dist/esm/project-config/loader.d.ts.map +1 -1
  49. package/dist/esm/project-config/loader.js +114 -1
  50. package/dist/esm/project-config/loader.js.map +1 -1
  51. package/dist/esm/project-config/provider-companion-discovery.d.ts +46 -0
  52. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  53. package/dist/esm/project-config/provider-companion-discovery.js +155 -13
  54. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  55. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +72 -23
  56. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  57. package/dist/esm/project-config/provider-runtime-artifacts.js +190 -17
  58. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  59. package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
  60. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  61. package/dist/esm/project-config/shared/auth.schemas.js +14 -35
  62. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  63. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +37 -7
  64. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  65. package/dist/esm/project-config/shared/backing-services.schemas.js +37 -7
  66. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  67. package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
  68. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  69. package/dist/esm/project-config/shared/csp.schemas.js +11 -12
  70. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  71. package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
  72. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  73. package/dist/esm/project-config/shared/environment.schemas.js +186 -9
  74. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  75. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +13 -3
  76. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  77. package/dist/esm/project-config/shared/infra-providers.schemas.js +0 -3
  78. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  79. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +140 -34
  80. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  81. package/dist/esm/project-config/shared/minion-resource-access.validation.js +174 -37
  82. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  83. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
  84. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  85. package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
  86. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  87. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
  88. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
  89. package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
  90. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
  91. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
  92. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
  93. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
  94. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
  95. package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
  96. package/dist/esm/registry/module-manifest.schemas.d.ts +10 -16
  97. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  98. package/dist/esm/registry/module-manifest.schemas.js +14 -20
  99. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  100. package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
  101. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  102. package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
  103. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  104. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +4 -3
  105. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  106. package/dist/esm/workspace-scope/workspace-homes.schemas.js +6 -5
  107. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  108. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
  109. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  110. package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
  111. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  112. package/dist/tsconfig.build.tsbuildinfo +1 -1
  113. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"define-infra-env-config.d.ts","sourceRoot":"","sources":["../../../../src/project-config/define-infra-env-config.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AO,CAAC,CAAC,CAAC,CAeZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,wBAAwB,GAAG,mBAAmB,CAiB1F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,8BAA8B,GAAG,yBAAyB,CAI5G"}
@@ -6,13 +6,21 @@ import { WildoAuthConfigSchema } from './shared/auth.schemas.js';
6
6
  import { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas.js';
7
7
  import { BackingServiceKind, BackingServiceSource, BackingServicesEnvConfigSchema } from './shared/backing-services.schemas.js';
8
8
  import { WildoCdnConfigSchema } from './shared/cdn.schemas.js';
9
+ import { WildoSystemsOfRecordEnvConfigSchema } from './shared/systems-of-record-env.schemas.js';
10
+ import { WildoPlatformStorageConfigSchema } from './shared/platform-storage.schemas.js';
9
11
  import { EnvCspOverrideSchema } from './shared/csp.schemas.js';
10
12
  import { WildoSchemaVersionSchema } from './shared/schema-version.schemas.js';
11
- import { InfraServiceAddressingSchema, InfraServiceK8sSchema, } from './shared/infra-service.schemas.js';
12
- import { DatabaseEngine, WildoDeploymentConfigSchema, WildoDeploymentRuntime, WildoEnvironment, WildoEnvironmentIdSchema, WildoKubernetesConfigSchema, WildoLocationType, WildoLoggingConfigSchema, WildoObservabilityConfigSchema, WildoDocumentationSiteConfigSchema, WildoProviderSelectionOverridesSchema, WildoRemoteProviderSchema, isLocalEnvironmentId, } from './shared/environment.schemas.js';
13
- const InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.extend({
14
- services: z.record(z.string(), InfraServiceK8sSchema).optional(),
15
- }).strict();
13
+ import { InfraServiceAddressingSchema, } from './shared/infra-service.schemas.js';
14
+ import { DatabaseEngine, resolveApplicationDatabaseEngine, WildoDeploymentConfigSchema, WildoDeploymentRuntime, WildoEnvironment, WildoEnvironmentIdSchema, WildoKubernetesConfigSchema, WildoLocationType, WildoLocalDataStorage, resolveDefaultLocalDataStorage, WildoLoggingConfigSchema, WildoObservabilityConfigSchema, WildoDocumentationSiteConfigSchema, WildoEnvironmentProviderConfigurationsSchema, WildoProviderSelectionOverridesSchema, WildoRemoteProviderSchema, WildoImageTagStrategy, isLocalEnvironmentId, } from './shared/environment.schemas.js';
15
+ const InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.strict();
16
+ /**
17
+ * A POSIX (`/…`), drive-letter (`C:\…`, `C:/…`) or UNC (`\\host\…`) absolute path.
18
+ *
19
+ * A pattern rather than `node:path`'s `isAbsolute` so the verdict does not depend on the platform the
20
+ * descriptor happens to be evaluated on: a Windows path committed by one developer must read as absolute
21
+ * on another's macOS machine too, or a machine-local host path could slip into a committed descriptor.
22
+ */
23
+ const ABSOLUTE_PATH_PATTERN = /^(?:\/|[A-Za-z]:[\\/]|\\\\)/;
16
24
  /**
17
25
  * DNS subdomain chain regex: one or more lowercase RFC 1123 labels
18
26
  * joined by dots. Empty string is allowed separately via the union
@@ -75,7 +83,15 @@ function getConsumedInfraCspServiceKeys() {
75
83
  }
76
84
  return new Set([...contextKeys, ...envKeys]);
77
85
  }
78
- const WildoInfraEnvConfigInputSchema = z.object({
86
+ /**
87
+ * The shape of a STANDALONE environment descriptor — one that owns its infrastructure.
88
+ *
89
+ * Kept as a plain object rather than inlined into `z.object(...)` because the HOSTED descriptor
90
+ * ({@link WildoHostedInfraEnvConfigSchema}) is built from a subset of these same members. Zod 4 refuses
91
+ * `.pick()` on an object that carries refinements, so sharing the members is the only way the two
92
+ * descriptors can agree on what an application-owned field IS without restating it.
93
+ */
94
+ const WILDO_INFRA_ENV_CONFIG_SHAPE = {
79
95
  /**
80
96
  * Authored schema-format version for this `wildo.infra.<env>.config.ts`,
81
97
  * expressed as a **SemVer 2.0.0 string** (e.g. `'1.0.0'`,
@@ -97,6 +113,19 @@ const WildoInfraEnvConfigInputSchema = z.object({
97
113
  locationType: z.enum(WildoLocationType).optional(),
98
114
  runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),
99
115
  runtime: z.enum(WildoDeploymentRuntime),
116
+ /**
117
+ * Where the self-hosted backing services of a DOCKER_COMPOSE environment keep their data —
118
+ * a Docker named volume, or a bind mount onto `<saas-root>/.wildo-saas/local_data/<service>/`.
119
+ *
120
+ * Omit it and the environment takes {@link resolveDefaultLocalDataStorage}: a named volume
121
+ * locally (the host-filesystem crossing costs ~4 CPU cores on macOS and Windows, and a named
122
+ * volume costs a Linux developer nothing), a host path remotely (the operator chooses the disk
123
+ * the database lands on). Author it to say otherwise — a remote deployment happy with Docker's
124
+ * own storage, or a local developer who wants to read the files directly.
125
+ *
126
+ * Ignored by KUBERNETES environments, which take their storage from PVs rather than from here.
127
+ */
128
+ localDataStorage: z.enum(WildoLocalDataStorage).optional(),
100
129
  /**
101
130
  * The store the PLATFORM's own data lives in (apps-manager + module-registry:
102
131
  * users, organizations, applications, sessions, API keys).
@@ -179,8 +208,11 @@ const WildoInfraEnvConfigInputSchema = z.object({
179
208
  * developer's machine. That is the same defect the platform `database` field above was added to
180
209
  * remove, and the reason both live in the authored, committed config.
181
210
  *
182
- * Absent means MongoDB, matching `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`'s own
183
- * default — so every existing deployment is unaffected by this field existing.
211
+ * Absent means POSTGRESQL (`DEFAULT_APPLICATION_DATABASE_ENGINE`, decided 2026-09-24, #1571), and
212
+ * every reader resolves it through `resolveApplicationDatabaseEngine` rather than re-deriving it —
213
+ * two readers answering silence differently is what stranded an application on 2026-09-15. So an
214
+ * environment that authors nothing here must still declare `backingServices.postgresql`; the
215
+ * refinement below refuses it otherwise.
184
216
  *
185
217
  * @example An application on PostgreSQL, on a platform that is also on PostgreSQL.
186
218
  * ```ts
@@ -251,8 +283,16 @@ const WildoInfraEnvConfigInputSchema = z.object({
251
283
  * environment. An empty string value mounts the service at the
252
284
  * apex of `publicDomain`.
253
285
  *
254
- * Explicit authoring only — there is NO auto-derivation from the
255
- * service key or from `frontendType`. An app-dev who wants the
286
+ * An UNMAPPED service falls back to its own key, lowercased, as its
287
+ * subdomain (`buildServicePublicHost`) — a defined path, not an error;
288
+ * nothing is derived from `frontendType`. Author an entry whenever the
289
+ * key is not the host you want, or is not a valid DNS label. Two
290
+ * services resolving to one host are refused when a REMOTE
291
+ * environment's ingress routes are built (`buildK8sApplicationIngressRoutes`);
292
+ * a local environment builds none and a CDN-served frontend is excluded
293
+ * from them, so neither is checked. (Corrected
294
+ * 2026-09-13: this comment said there was NO derivation from the key,
295
+ * which the resolver has not matched.) An app-dev who wants the
256
296
  * docs service to live at `dev.example.com` (rather than the more
257
297
  * conventional `docs.example.com`) writes
258
298
  * `serviceHosts: { docs: 'dev' }` here; an app-dev who splits
@@ -305,6 +345,14 @@ const WildoInfraEnvConfigInputSchema = z.object({
305
345
  * See {@link WildoProviderSelectionOverridesSchema}.
306
346
  */
307
347
  providerSelection: WildoProviderSelectionOverridesSchema.optional(),
348
+ /**
349
+ * Per-environment provider configuration values — an OAuth client ID, a frontend SDK DSN or site key — laid over
350
+ * `wildo.saas.config.ts > providerConfigurations` key by key for THIS environment. Author here every value a vendor
351
+ * issued against one deployment; keep application policy (an agent execution profile) in the SaaS config.
352
+ * Never a secret: those stay in `secrets.json → providerEnv`. See
353
+ * {@link WildoEnvironmentProviderConfigurationsSchema}.
354
+ */
355
+ providerConfigurations: WildoEnvironmentProviderConfigurationsSchema.optional(),
308
356
  /**
309
357
  * Per-environment origins the documentation site is BUILT against.
310
358
  *
@@ -423,8 +471,43 @@ const WildoInfraEnvConfigInputSchema = z.object({
423
471
  cdn: z
424
472
  .record(z.string().min(1), WildoCdnConfigSchema)
425
473
  .optional(),
474
+ /**
475
+ * WHERE each declared system of record lives in THIS environment, keyed by the instance name the
476
+ * saas config declares (#1055). See {@link WildoSystemsOfRecordEnvConfigSchema}: either an address,
477
+ * or `{ enabled: false }` for an environment that has no access to the instance at all.
478
+ *
479
+ * `.optional()` — an application that reads nothing out of another system authors none. An instance
480
+ * the saas config DOES declare and this block omits is refused at `wildo config sync` and at boot,
481
+ * because silence is not a declaration of absence; `{ enabled: false }` is.
482
+ */
483
+ systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),
484
+ /**
485
+ * The PLATFORM tier's own object-storage bucket, REMOTE environments only (#1112). See
486
+ * {@link WildoPlatformStorageConfigSchema}: not this application's bucket (that is `backingServices.s3.bucket`),
487
+ * and refused in a local environment, whose platform bucket is a constant shared by every application.
488
+ */
489
+ platformStorage: WildoPlatformStorageConfigSchema.optional(),
426
490
  devCompanion: InfraServiceAddressingSchema.optional(),
427
- }).strict().superRefine((config, ctx) => {
491
+ /**
492
+ * Present only on an environment RESOLVED from a hosted descriptor: this application runs on the
493
+ * infrastructure of another application, whose root and descriptor are named here as absolute paths.
494
+ *
495
+ * Never authored in this form. An application declares its host with a RELATIVE
496
+ * `infrastructureHost.applicationRoot` in a hosted descriptor (`defineHostedInfraEnvConfig`, {@link WildoHostedInfraEnvConfigSchema}),
497
+ * and `loadInfraEnvConfig` produces this value while merging the host's platform-level fields in. The
498
+ * absolute-path requirement is what keeps the two apart: a committed descriptor cannot carry a
499
+ * machine-local path, so it cannot pass itself off as already resolved.
500
+ *
501
+ * Every consumer that would otherwise act on SHARED infrastructure — render the platform compose file,
502
+ * converge containers, start or initialize the platform, write platform-service env files, bootstrap a
503
+ * cluster — reads this field and leaves that action to the host.
504
+ */
505
+ infrastructureHost: z.strictObject({
506
+ applicationRoot: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.applicationRoot must be absolute once resolved.'),
507
+ infraConfigPath: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.infraConfigPath must be absolute once resolved.'),
508
+ }).optional(),
509
+ };
510
+ const WildoInfraEnvConfigInputSchema = z.object(WILDO_INFRA_ENV_CONFIG_SHAPE).strict().superRefine((config, ctx) => {
428
511
  const resolvedEnvironment = config.environment;
429
512
  const resolvedLocationType = config.locationType
430
513
  ?? (isLocalEnvironmentId(resolvedEnvironment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);
@@ -460,7 +543,13 @@ const WildoInfraEnvConfigInputSchema = z.object({
460
543
  * (see `.claude/rules/invariant-call-site-enumeration.md`: an invariant enforced at one of its
461
544
  * sites is enforced at none of the others).
462
545
  */
463
- if (config.database?.engine === DatabaseEngine.POSTGRESQL) {
546
+ /*
547
+ * Scoped to an environment that OWNS its platform. A hosted environment's `database` is the host's,
548
+ * validated when the host's own descriptor was parsed; its `backingServices` are only the stores the
549
+ * hosted application itself uses, so a Mongo-backed application on a PostgreSQL platform would be
550
+ * refused here for a store it never asked for.
551
+ */
552
+ if (config.database?.engine === DatabaseEngine.POSTGRESQL && config.infrastructureHost === undefined) {
464
553
  if (!config.backingServices[BackingServiceKind.POSTGRESQL]) {
465
554
  ctx.addIssue({
466
555
  code: z.ZodIssueCode.custom,
@@ -499,20 +588,24 @@ const WildoInfraEnvConfigInputSchema = z.object({
499
588
  */
500
589
  }
501
590
  /**
502
- * An application cannot persist to a store the environment does not declare.
591
+ * An application cannot persist to a store the environment does not declare — including the store
592
+ * it selects by SILENCE, which is PostgreSQL. Resolved rather than compared to the authored value,
593
+ * so an environment that declares nothing and provisions no PostgreSQL is refused at authoring time
594
+ * instead of registering an application with no store.
503
595
  *
504
596
  * Deliberately NOT symmetric with the platform rule above: that one also requires MongoDB to stay
505
597
  * declared, because the platform's own BOOTSTRAP plane is Mongo-wired. An application has no such
506
598
  * plane — once its resources are on PostgreSQL, nothing of the application's needs a mongod — so
507
599
  * requiring one here would forbid the very end-state this field exists to reach.
508
600
  */
509
- if (config.applicationDatabase?.engine === DatabaseEngine.POSTGRESQL
601
+ if (resolveApplicationDatabaseEngine(config.applicationDatabase) === DatabaseEngine.POSTGRESQL
510
602
  && config.backingServices[BackingServiceKind.POSTGRESQL] === undefined) {
511
603
  ctx.addIssue({
512
604
  code: z.ZodIssueCode.custom,
513
605
  path: ['backingServices', BackingServiceKind.POSTGRESQL],
514
- message: 'applicationDatabase.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the '
515
- + 'application would be pointed at a PostgreSQL that nothing provisions. Declare it alongside.',
606
+ message: 'The application persists to PostgreSQL (declared, or selected because `applicationDatabase` is '
607
+ + 'absent) but no `backingServices.postgresql` is declared: it would be pointed at a PostgreSQL that '
608
+ + 'nothing provisions. Declare it, or author `applicationDatabase: { engine: DatabaseEngine.MONGODB }`.',
516
609
  });
517
610
  }
518
611
  if (!isLocalEnvironmentId(resolvedEnvironment) && config.applicationCreationVerification !== undefined) {
@@ -577,6 +670,17 @@ const WildoInfraEnvConfigInputSchema = z.object({
577
670
  // block outside a remote env at parse time so a config copy-pasted from a
578
671
  // remote env can't silently make `wildo frontend publish --env local`
579
672
  // attempt an S3 upload (and so the semantic stays enforced, not implicit).
673
+ // The platform's own bucket is authored only for a REMOTE environment (#1112). A local platform is shared by
674
+ // every application beside it, and each has its own infra file, so letting one author it would make the
675
+ // platform's bucket whichever application synced last — the defect this field exists to remove.
676
+ if (config.platformStorage && resolvedLocationType !== WildoLocationType.REMOTE) {
677
+ ctx.addIssue({
678
+ code: 'custom',
679
+ path: ['platformStorage'],
680
+ message: 'platformStorage is only valid in a REMOTE environment — a local platform is shared by every '
681
+ + 'application beside it and uses the fixed platform bucket. Author it only in wildo.infra.remote.config.ts.',
682
+ });
683
+ }
580
684
  if (config.cdn && resolvedLocationType !== WildoLocationType.REMOTE) {
581
685
  for (const serviceKey of Object.keys(config.cdn)) {
582
686
  ctx.addIssue({
@@ -599,6 +703,11 @@ export const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transfor
599
703
  locationType,
600
704
  runtimeEnvironment: config.runtimeEnvironment,
601
705
  runtime: config.runtime,
706
+ /**
707
+ * Resolved here rather than left `undefined` for a downstream consumer to default, so every
708
+ * reader sees one answer. The derivation is total over `WildoLocationType`.
709
+ */
710
+ localDataStorage: config.localDataStorage ?? resolveDefaultLocalDataStorage(locationType),
602
711
  /**
603
712
  * Projected EXPLICITLY, like every field here — this list IS the contract, and a field omitted
604
713
  * from it is silently dropped no matter what the input schema accepted. `undefined` when the
@@ -616,14 +725,258 @@ export const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transfor
616
725
  logging: config.logging,
617
726
  observability: config.observability,
618
727
  providerSelection: config.providerSelection,
728
+ providerConfigurations: config.providerConfigurations,
619
729
  applicationCreationVerification: config.applicationCreationVerification,
620
730
  serviceAuth: config.serviceAuth,
621
731
  csp: config.csp,
622
732
  cdn: config.cdn,
733
+ systemsOfRecord: config.systemsOfRecord,
734
+ platformStorage: config.platformStorage,
623
735
  documentationSite: config.documentationSite,
624
736
  devCompanion: config.devCompanion,
737
+ infrastructureHost: config.infrastructureHost,
625
738
  };
626
739
  });
740
+ // =============================================================================
741
+ // Hosted environment descriptors — an application running on another application's infrastructure
742
+ // =============================================================================
743
+ /**
744
+ * Who decides one member of an environment descriptor when the application is HOSTED.
745
+ *
746
+ * Several applications share one platform per environment: one application OWNS the infrastructure
747
+ * (the platform services and every backing service), and the others reference it through
748
+ * `infrastructureHost`. Each member of the descriptor belongs to exactly one side, and this vocabulary is
749
+ * how that is stated — per member, in {@link INFRA_ENV_FIELD_OWNERSHIP}, so a member added tomorrow cannot
750
+ * compile until somebody decides whose it is.
751
+ */
752
+ export var InfraEnvFieldOwner;
753
+ (function (InfraEnvFieldOwner) {
754
+ /**
755
+ * The hosted application authors it, and it may differ from the host's: its public domain, its CSP,
756
+ * its provider choices, its companion port. Taken verbatim from the hosted descriptor.
757
+ */
758
+ InfraEnvFieldOwner["APPLICATION"] = "application";
759
+ /**
760
+ * The host decides it, and a hosted descriptor may not author it: the runtime, the platform database,
761
+ * the cluster, the remote provider, the platform bucket. Authoring one in a hosted descriptor is
762
+ * refused — two applications on one platform cannot disagree about what that platform is.
763
+ */
764
+ InfraEnvFieldOwner["HOST"] = "host";
765
+ /**
766
+ * Split inside the member. Backing services: the host owns each SERVER (`source`, `host`, `port`,
767
+ * `provider`, `endpoint`), the application owns its NAME on that server (database, vhost, bucket).
768
+ * Kubernetes: the host owns the namespace and ingress class, the application its replica counts.
769
+ * Deployment: the host owns the runtime, the application its branch and image tagging.
770
+ */
771
+ InfraEnvFieldOwner["PARTITIONED"] = "partitioned";
772
+ /**
773
+ * Produced by resolution and never authored in its resolved form (`infrastructureHost`).
774
+ */
775
+ InfraEnvFieldOwner["RESOLUTION"] = "resolution";
776
+ })(InfraEnvFieldOwner || (InfraEnvFieldOwner = {}));
777
+ /**
778
+ * Whose decision each member of a standalone descriptor is, when the application is hosted.
779
+ *
780
+ * Total over {@link WILDO_INFRA_ENV_CONFIG_SHAPE} by type, which is the point: `providerConfigurations`
781
+ * landed on the shape while this feature was being written, and a hosted descriptor built from a
782
+ * hand-kept list would have dropped it silently. `hosted-infra-env-config.test.ts` pins that the hosted
783
+ * schema accepts exactly the APPLICATION and PARTITIONED members.
784
+ */
785
+ export const INFRA_ENV_FIELD_OWNERSHIP = {
786
+ version: InfraEnvFieldOwner.APPLICATION,
787
+ environment: InfraEnvFieldOwner.APPLICATION,
788
+ locationType: InfraEnvFieldOwner.HOST,
789
+ runtimeEnvironment: InfraEnvFieldOwner.HOST,
790
+ runtime: InfraEnvFieldOwner.HOST,
791
+ /*
792
+ * HOST. It says how the SHARED backing services store their data, and there is one set of those
793
+ * containers per platform — a hosted application cannot have mongod keep its data in a volume
794
+ * while the host keeps it on a bind mount, because it is the same mongod. Same family as
795
+ * `runtime` and `database`: a property of the substrate, not of anyone running on it. The host
796
+ * also writes the compose file this member shapes, so a hosted descriptor authoring it would be
797
+ * describing a file it does not own.
798
+ */
799
+ localDataStorage: InfraEnvFieldOwner.HOST,
800
+ database: InfraEnvFieldOwner.HOST,
801
+ applicationDatabase: InfraEnvFieldOwner.APPLICATION,
802
+ publicDomain: InfraEnvFieldOwner.APPLICATION,
803
+ serviceHosts: InfraEnvFieldOwner.APPLICATION,
804
+ kubernetes: InfraEnvFieldOwner.PARTITIONED,
805
+ remoteProvider: InfraEnvFieldOwner.HOST,
806
+ deployment: InfraEnvFieldOwner.PARTITIONED,
807
+ backingServices: InfraEnvFieldOwner.PARTITIONED,
808
+ logging: InfraEnvFieldOwner.APPLICATION,
809
+ /*
810
+ * APPLICATION, deliberately: `enabled` and `llmObservability` are per-application postures. The OTLP
811
+ * `endpoint` usually names the shared collector, and nothing stops an application pointing its own
812
+ * telemetry elsewhere — that is a destination choice, not a divergence in what the platform runs.
813
+ */
814
+ observability: InfraEnvFieldOwner.APPLICATION,
815
+ providerSelection: InfraEnvFieldOwner.APPLICATION,
816
+ providerConfigurations: InfraEnvFieldOwner.APPLICATION,
817
+ /*
818
+ * APPLICATION. `systemsOfRecord` says where the instances THIS application declares in its saas config live in
819
+ * this environment — an external system it reads from (an ERP), never part of the shared substrate its host
820
+ * runs. Two applications on one platform read from different systems, or from none: handing a hosted
821
+ * application its host's ERP address and credential would be a cross-tenant read nobody asked for, and
822
+ * `{ enabled: false }` is exactly how an environment says it has no access.
823
+ */
824
+ systemsOfRecord: InfraEnvFieldOwner.APPLICATION,
825
+ documentationSite: InfraEnvFieldOwner.APPLICATION,
826
+ applicationCreationVerification: InfraEnvFieldOwner.APPLICATION,
827
+ serviceAuth: InfraEnvFieldOwner.APPLICATION,
828
+ csp: InfraEnvFieldOwner.APPLICATION,
829
+ cdn: InfraEnvFieldOwner.APPLICATION,
830
+ platformStorage: InfraEnvFieldOwner.HOST,
831
+ devCompanion: InfraEnvFieldOwner.APPLICATION,
832
+ infrastructureHost: InfraEnvFieldOwner.RESOLUTION,
833
+ };
834
+ /**
835
+ * Which field of a backing-service entry names the APPLICATION'S OWN slice of a shared server.
836
+ *
837
+ * `mustDifferFromHost` is true where the framework's fallback for an unnamed slice is a SHARED constant —
838
+ * `'wildo_app'` for a Mongo or PostgreSQL database, the default vhost `/`, the fixed platform bucket. On
839
+ * those servers two applications that name the same slice are one application's data, silently, so a
840
+ * hosted application must name its own and it must not be the host's. Redis is exempt: every application
841
+ * already shares index 0, isolated by its own ACL principal and key prefix. Immudb's `database` has no
842
+ * consumer today, so it is stripped from the host's entry and not authored by the hosted one.
843
+ */
844
+ export const BACKING_SERVICE_APPLICATION_NAME_FIELDS = {
845
+ [BackingServiceKind.MONGODB]: { field: 'database', mustDifferFromHost: true },
846
+ [BackingServiceKind.REDIS]: { field: 'database', mustDifferFromHost: false },
847
+ [BackingServiceKind.RABBITMQ]: { field: 'vhost', mustDifferFromHost: true },
848
+ [BackingServiceKind.S3]: { field: 'bucket', mustDifferFromHost: true },
849
+ [BackingServiceKind.POSTGRESQL]: { field: 'database', mustDifferFromHost: true },
850
+ [BackingServiceKind.CLAMAV]: null,
851
+ [BackingServiceKind.IMMUDB]: { field: 'database', mustDifferFromHost: false },
852
+ [BackingServiceKind.BACKUP]: null,
853
+ };
854
+ /**
855
+ * Error-map for a strict object whose unknown keys are almost always host-owned members an author
856
+ * carried over from a standalone descriptor. Zod's own "Unrecognized key" names the key but not the
857
+ * reason, and the reason is the whole lesson.
858
+ */
859
+ function refuseHostOwnedKeys(scope) {
860
+ return {
861
+ error: (issue) => {
862
+ if (issue.code !== 'unrecognized_keys' || !issue.keys?.length)
863
+ return undefined;
864
+ const keys = issue.keys.map((key) => `\`${key}\``).join(', ');
865
+ return `${scope}: ${keys} cannot be authored by a hosted application. Its infrastructure host decides `
866
+ + 'the platform (runtime, database, cluster, remote provider, platform storage) and every backing-service '
867
+ + 'server; a hosted application authors only its own names on those servers (database, vhost, bucket).';
868
+ },
869
+ };
870
+ }
871
+ const HOSTED_BACKING_SERVICES_SHAPE = {
872
+ [BackingServiceKind.MONGODB]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.mongodb')).optional(),
873
+ [BackingServiceKind.REDIS]: z.strictObject({ database: z.number().int().min(0).max(15).optional() }, refuseHostOwnedKeys('backingServices.redis')).optional(),
874
+ [BackingServiceKind.RABBITMQ]: z.strictObject({ vhost: z.string().min(1) }, refuseHostOwnedKeys('backingServices.rabbitmq')).optional(),
875
+ [BackingServiceKind.S3]: z.strictObject({ bucket: z.string().min(1) }, refuseHostOwnedKeys('backingServices.s3')).optional(),
876
+ [BackingServiceKind.POSTGRESQL]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.postgresql')).optional(),
877
+ [BackingServiceKind.CLAMAV]: z.strictObject({}, refuseHostOwnedKeys('backingServices.clamav')).optional(),
878
+ [BackingServiceKind.IMMUDB]: z.strictObject({}, refuseHostOwnedKeys('backingServices.immudb')).optional(),
879
+ [BackingServiceKind.BACKUP]: z.strictObject({}, refuseHostOwnedKeys('backingServices.backup')).optional(),
880
+ };
881
+ /**
882
+ * The backing services a HOSTED application uses — each one a store its host must declare.
883
+ *
884
+ * Listing a kind is how the application states it NEEDS that store; the entry carries only the
885
+ * application's own name on the host's server. Every name field is REQUIRED where
886
+ * {@link BACKING_SERVICE_APPLICATION_NAME_FIELDS} says the unnamed fallback is shared.
887
+ */
888
+ export const HostedBackingServicesEnvConfigSchema = z.strictObject(HOSTED_BACKING_SERVICES_SHAPE, refuseHostOwnedKeys('backingServices'));
889
+ /** @wildo_source:part:start platform.config.infrastructure-host facet:layer:platform facet:family:bootstrap facet:audience:app-developer */
890
+ /**
891
+ * An environment descriptor for an application that runs on ANOTHER application's infrastructure.
892
+ *
893
+ * One application per environment owns the infrastructure — its platform services (apps-manager,
894
+ * module-registry, crontabs) and every backing service. Other applications declare that owner as their
895
+ * `infrastructureHost` and author only what is theirs: domain, CSP, provider choices, companion address,
896
+ * and their own database/vhost/bucket names on the host's servers. Everything else comes from the host's
897
+ * descriptor for the SAME environment when the descriptor is loaded, so the two cannot diverge — not in
898
+ * which stores exist, not in how they are reached, not between Docker Compose and Kubernetes.
899
+ *
900
+ * The link is per environment: author it in `wildo.infra.local.config.ts` to share a local platform while
901
+ * `staging` stays standalone, or in both.
902
+ *
903
+ * Refusals, all at load time, all naming both descriptors:
904
+ * - the host root holds no `wildo.saas.config.ts` — a hosted application needs its host's SOURCE checked
905
+ * out at that path;
906
+ * - the host has no descriptor for this environment, or is itself hosted;
907
+ * - a store this application lists is not declared by the host;
908
+ * - a database, vhost or bucket name equals the host's.
909
+ *
910
+ * @example Wonder CRM on Wonder Todos' local platform.
911
+ * ```ts
912
+ * export default defineHostedInfraEnvConfig({
913
+ * environment: WildoEnvironment.LOCAL,
914
+ * infrastructureHost: { applicationRoot: '../wonder-todos' },
915
+ * publicDomain: 'localhost',
916
+ * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },
917
+ * backingServices: {
918
+ * postgresql: { database: 'wonder-crm-db' },
919
+ * redis: { database: 0 },
920
+ * rabbitmq: { vhost: 'wonder-crm' },
921
+ * s3: { bucket: 'wonder-crm-local' },
922
+ * },
923
+ * devCompanion: { host: 'localhost', port: 4351 },
924
+ * });
925
+ * ```
926
+ */
927
+ export const WildoHostedInfraEnvConfigSchema = z.strictObject({
928
+ infrastructureHost: z.strictObject({
929
+ /**
930
+ * The host application's root — the directory holding its `wildo.saas.config.ts` — RELATIVE to this
931
+ * application's root. Relative because the descriptor is committed: an absolute path is one machine's
932
+ * checkout layout, and would break on every other.
933
+ */
934
+ applicationRoot: z.string().min(1).refine((value) => !ABSOLUTE_PATH_PATTERN.test(value), 'infrastructureHost.applicationRoot must be relative to this application root (e.g. "../wonder-todos"): the descriptor is committed, and an absolute path only exists on one machine.'),
935
+ }, refuseHostOwnedKeys('infrastructureHost')),
936
+ version: WILDO_INFRA_ENV_CONFIG_SHAPE.version,
937
+ environment: WILDO_INFRA_ENV_CONFIG_SHAPE.environment,
938
+ applicationDatabase: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationDatabase,
939
+ publicDomain: WILDO_INFRA_ENV_CONFIG_SHAPE.publicDomain,
940
+ serviceHosts: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceHosts,
941
+ kubernetes: z.strictObject({
942
+ services: WildoKubernetesConfigSchema.shape.services,
943
+ }, refuseHostOwnedKeys('kubernetes')).optional(),
944
+ deployment: z.strictObject({
945
+ branch: z.string().min(1),
946
+ imageTagStrategy: z.enum(WildoImageTagStrategy).optional(),
947
+ // No `registry`: images live at the host's `remoteProvider.registryEndpoint`, which its manifests pull from (#1165).
948
+ }, refuseHostOwnedKeys('deployment')).optional(),
949
+ backingServices: HostedBackingServicesEnvConfigSchema.optional(),
950
+ logging: WILDO_INFRA_ENV_CONFIG_SHAPE.logging,
951
+ observability: WILDO_INFRA_ENV_CONFIG_SHAPE.observability,
952
+ providerSelection: WILDO_INFRA_ENV_CONFIG_SHAPE.providerSelection,
953
+ providerConfigurations: WILDO_INFRA_ENV_CONFIG_SHAPE.providerConfigurations,
954
+ systemsOfRecord: WILDO_INFRA_ENV_CONFIG_SHAPE.systemsOfRecord,
955
+ documentationSite: WILDO_INFRA_ENV_CONFIG_SHAPE.documentationSite,
956
+ applicationCreationVerification: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationCreationVerification,
957
+ serviceAuth: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceAuth,
958
+ csp: WILDO_INFRA_ENV_CONFIG_SHAPE.csp,
959
+ cdn: WILDO_INFRA_ENV_CONFIG_SHAPE.cdn,
960
+ devCompanion: WILDO_INFRA_ENV_CONFIG_SHAPE.devCompanion,
961
+ }, refuseHostOwnedKeys('a hosted environment descriptor'));
962
+ /**
963
+ * Whether an evaluated descriptor is a hosted one still awaiting resolution.
964
+ *
965
+ * Keyed on the AUTHORED key, exactly as {@link defineInfraEnvConfig} dispatches: an `infrastructureHost`
966
+ * in its authored form, which names a relative root and no `infraConfigPath`. A RESOLVED hosted
967
+ * environment carries `infraConfigPath` and is a {@link WildoInfraEnvConfig} — consumers ask
968
+ * `config.infrastructureHost !== undefined` for that.
969
+ *
970
+ * An earlier revision keyed on the absence of `runtime`, reasoning that every standalone descriptor
971
+ * requires it. That holds for a descriptor built through `defineInfraEnvConfig` and not for a plain
972
+ * `export default {…}` object, which the loader also evaluates: a partial standalone descriptor with no
973
+ * `runtime` was read as hosted and crashed on its missing host. Discriminate on what the author wrote,
974
+ * never on what a schema happens to require.
975
+ */
976
+ export function isHostedInfraEnvConfig(config) {
977
+ const host = config.infrastructureHost;
978
+ return host !== undefined && host !== null && !('infraConfigPath' in host);
979
+ }
627
980
  /**
628
981
  * Scope `csp.<serviceKey>` warning suppression to the current async load path.
629
982
  *
@@ -663,10 +1016,38 @@ export async function withConsumedInfraCspServiceKeys(serviceKeys, callback) {
663
1016
  * format = single-line with backlog ID).
664
1017
  */
665
1018
  export function defineInfraEnvConfig(config) {
1019
+ /*
1020
+ * An `infrastructureHost` is never authored here: a hosted environment is a different descriptor with its
1021
+ * own entry point, and its resolved form (absolute paths) is produced only by `loadInfraEnvConfig`.
1022
+ * Refused by name before the schema runs, because the schema's own complaint ("must be absolute once
1023
+ * resolved") would send the author in the wrong direction.
1024
+ */
1025
+ if (config.infrastructureHost !== undefined) {
1026
+ throw new Error('defineInfraEnvConfig describes an environment that OWNS its infrastructure, so it takes no infrastructureHost. '
1027
+ + 'An application running on another application\'s infrastructure is declared with defineHostedInfraEnvConfig({ '
1028
+ + 'infrastructureHost: { applicationRoot: \'../<host-app>\' }, … }).');
1029
+ }
666
1030
  const parsed = WildoInfraEnvConfigSchema.parse(config);
667
1031
  emitInfraUnimplementedRuntimeWarnings(parsed);
668
1032
  return parsed;
669
1033
  }
1034
+ /**
1035
+ * Define an environment descriptor for an application that runs on ANOTHER application's infrastructure.
1036
+ * See {@link WildoHostedInfraEnvConfigSchema} for what it may author and what comes from the host.
1037
+ *
1038
+ * A separate entry point rather than a variant of {@link defineInfraEnvConfig}, deliberately. "This
1039
+ * environment owns its platform" and "this environment runs on someone else's" are different decisions
1040
+ * with different fields, and one function accepting both made a type error in either shape report as "No
1041
+ * overload matches this call" at the call instead of at the offending property — worse feedback for every
1042
+ * author of every descriptor, standalone ones included.
1043
+ *
1044
+ * The result is NOT an environment yet: `loadInfraEnvConfig` resolves it against the host.
1045
+ */
1046
+ export function defineHostedInfraEnvConfig(config) {
1047
+ const parsed = WildoHostedInfraEnvConfigSchema.parse(config);
1048
+ emitInfraUnimplementedRuntimeWarnings(parsed);
1049
+ return parsed;
1050
+ }
670
1051
  /**
671
1052
  * Emit `@unimplemented` parse-time warnings for every authored
672
1053
  * `WildoInfraEnvConfig` field that remains reserved or is not declared as