@wildo-ai/wildo-cli 1.1.14 → 1.1.16

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 (211) hide show
  1. package/dist/src/commands/context/journey.command.d.ts.map +1 -1
  2. package/dist/src/commands/context/journey.command.js +12 -0
  3. package/dist/src/commands/context/journey.command.js.map +1 -1
  4. package/dist/src/commands/creation/drive.command.d.ts.map +1 -1
  5. package/dist/src/commands/creation/drive.command.js +2 -1
  6. package/dist/src/commands/creation/drive.command.js.map +1 -1
  7. package/dist/src/commands/generate/email-command.utils.d.ts +2 -0
  8. package/dist/src/commands/generate/email-command.utils.d.ts.map +1 -1
  9. package/dist/src/commands/generate/email-command.utils.js +5 -0
  10. package/dist/src/commands/generate/email-command.utils.js.map +1 -1
  11. package/dist/src/commands/init.command.d.ts.map +1 -1
  12. package/dist/src/commands/init.command.js +7 -2
  13. package/dist/src/commands/init.command.js.map +1 -1
  14. package/dist/src/commands/local/deregister.command.d.ts.map +1 -1
  15. package/dist/src/commands/local/deregister.command.js +4 -0
  16. package/dist/src/commands/local/deregister.command.js.map +1 -1
  17. package/dist/src/commands/local/dev.command.d.ts +50 -0
  18. package/dist/src/commands/local/dev.command.d.ts.map +1 -1
  19. package/dist/src/commands/local/dev.command.js +144 -1
  20. package/dist/src/commands/local/dev.command.js.map +1 -1
  21. package/dist/src/commands/local/jobs-command.utils.d.ts +24 -0
  22. package/dist/src/commands/local/jobs-command.utils.d.ts.map +1 -0
  23. package/dist/src/commands/local/jobs-command.utils.js +44 -0
  24. package/dist/src/commands/local/jobs-command.utils.js.map +1 -0
  25. package/dist/src/commands/local/jobs-run.command.d.ts +7 -0
  26. package/dist/src/commands/local/jobs-run.command.d.ts.map +1 -0
  27. package/dist/src/commands/local/jobs-run.command.js +92 -0
  28. package/dist/src/commands/local/jobs-run.command.js.map +1 -0
  29. package/dist/src/commands/local/jobs.command.d.ts +7 -0
  30. package/dist/src/commands/local/jobs.command.d.ts.map +1 -0
  31. package/dist/src/commands/local/jobs.command.js +59 -0
  32. package/dist/src/commands/local/jobs.command.js.map +1 -0
  33. package/dist/src/commands/local/tunnel.command.d.ts +84 -0
  34. package/dist/src/commands/local/tunnel.command.d.ts.map +1 -0
  35. package/dist/src/commands/local/tunnel.command.js +274 -0
  36. package/dist/src/commands/local/tunnel.command.js.map +1 -0
  37. package/dist/src/commands/providers/grant-export.command.d.ts +16 -0
  38. package/dist/src/commands/providers/grant-export.command.d.ts.map +1 -0
  39. package/dist/src/commands/providers/grant-export.command.js +78 -0
  40. package/dist/src/commands/providers/grant-export.command.js.map +1 -0
  41. package/dist/src/commands/providers/grant-import.command.d.ts +15 -0
  42. package/dist/src/commands/providers/grant-import.command.d.ts.map +1 -0
  43. package/dist/src/commands/providers/grant-import.command.js +78 -0
  44. package/dist/src/commands/providers/grant-import.command.js.map +1 -0
  45. package/dist/src/kernel/command-runner.d.ts.map +1 -1
  46. package/dist/src/kernel/command-runner.js +4 -6
  47. package/dist/src/kernel/command-runner.js.map +1 -1
  48. package/dist/src/kernel/hooks.d.ts.map +1 -1
  49. package/dist/src/kernel/hooks.js +2 -1
  50. package/dist/src/kernel/hooks.js.map +1 -1
  51. package/dist/src/kernel/json-document-output.d.ts +7 -0
  52. package/dist/src/kernel/json-document-output.d.ts.map +1 -1
  53. package/dist/src/kernel/json-document-output.js +8 -0
  54. package/dist/src/kernel/json-document-output.js.map +1 -1
  55. package/dist/src/kernel/types.d.ts +8 -0
  56. package/dist/src/kernel/types.d.ts.map +1 -1
  57. package/dist/src/kernel/types.js.map +1 -1
  58. package/dist/src/services/application/app-bootstrap.service.d.ts +65 -7
  59. package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
  60. package/dist/src/services/application/app-bootstrap.service.js +94 -15
  61. package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
  62. package/dist/src/services/application/app-local-runtime-addresses.service.d.ts +1 -1
  63. package/dist/src/services/application/app-local-runtime-addresses.service.d.ts.map +1 -1
  64. package/dist/src/services/application/app-local-runtime-addresses.service.js.map +1 -1
  65. package/dist/src/services/application/app-runtime-targets.service.d.ts.map +1 -1
  66. package/dist/src/services/application/app-runtime-targets.service.js +16 -2
  67. package/dist/src/services/application/app-runtime-targets.service.js.map +1 -1
  68. package/dist/src/services/application/application-dependency-alignment.service.d.ts +20 -0
  69. package/dist/src/services/application/application-dependency-alignment.service.d.ts.map +1 -1
  70. package/dist/src/services/application/application-dependency-alignment.service.js +32 -2
  71. package/dist/src/services/application/application-dependency-alignment.service.js.map +1 -1
  72. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts +13 -0
  73. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts.map +1 -1
  74. package/dist/src/services/application/application-runtime-bootstrap.service.js +32 -0
  75. package/dist/src/services/application/application-runtime-bootstrap.service.js.map +1 -1
  76. package/dist/src/services/application/environment-provider-configurations.service.d.ts +7 -0
  77. package/dist/src/services/application/environment-provider-configurations.service.d.ts.map +1 -1
  78. package/dist/src/services/application/environment-provider-configurations.service.js +1 -1
  79. package/dist/src/services/application/environment-provider-configurations.service.js.map +1 -1
  80. package/dist/src/services/application/local-tunnel.service.d.ts +153 -0
  81. package/dist/src/services/application/local-tunnel.service.d.ts.map +1 -0
  82. package/dist/src/services/application/local-tunnel.service.js +295 -0
  83. package/dist/src/services/application/local-tunnel.service.js.map +1 -0
  84. package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
  85. package/dist/src/services/application/provider-runtime-sync.service.js +3 -0
  86. package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
  87. package/dist/src/services/application/saas-skeleton.service.d.ts +7 -0
  88. package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
  89. package/dist/src/services/application/saas-skeleton.service.js +2 -0
  90. package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
  91. package/dist/src/services/catalog/service-address-resolver.service.d.ts +7 -1
  92. package/dist/src/services/catalog/service-address-resolver.service.d.ts.map +1 -1
  93. package/dist/src/services/catalog/service-address-resolver.service.js +6 -3
  94. package/dist/src/services/catalog/service-address-resolver.service.js.map +1 -1
  95. package/dist/src/services/companion/companion-client.service.d.ts +17 -0
  96. package/dist/src/services/companion/companion-client.service.d.ts.map +1 -1
  97. package/dist/src/services/companion/companion-client.service.js +21 -0
  98. package/dist/src/services/companion/companion-client.service.js.map +1 -1
  99. package/dist/src/services/companion/creation-drive.service.d.ts +18 -0
  100. package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
  101. package/dist/src/services/companion/creation-drive.service.js +70 -1
  102. package/dist/src/services/companion/creation-drive.service.js.map +1 -1
  103. package/dist/src/services/credentials/application-secrets.service.d.ts +6 -0
  104. package/dist/src/services/credentials/application-secrets.service.d.ts.map +1 -1
  105. package/dist/src/services/credentials/application-secrets.service.js +1 -1
  106. package/dist/src/services/credentials/application-secrets.service.js.map +1 -1
  107. package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
  108. package/dist/src/services/credentials/provider-env-vars.utils.js +3 -1
  109. package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
  110. package/dist/src/services/credentials/secrets-writer.service.d.ts +11 -2
  111. package/dist/src/services/credentials/secrets-writer.service.d.ts.map +1 -1
  112. package/dist/src/services/credentials/secrets-writer.service.js +12 -3
  113. package/dist/src/services/credentials/secrets-writer.service.js.map +1 -1
  114. package/dist/src/services/deployment/ci-deploy-generator.service.d.ts.map +1 -1
  115. package/dist/src/services/deployment/ci-deploy-generator.service.js +3 -3
  116. package/dist/src/services/deployment/ci-deploy-generator.service.js.map +1 -1
  117. package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts +12 -3
  118. package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
  119. package/dist/src/services/deployment/docker/docker-compose-generator.service.js +40 -22
  120. package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
  121. package/dist/src/services/deployment/framework-pod-network-membership.d.ts +6 -0
  122. package/dist/src/services/deployment/framework-pod-network-membership.d.ts.map +1 -1
  123. package/dist/src/services/deployment/framework-pod-network-membership.js +17 -3
  124. package/dist/src/services/deployment/framework-pod-network-membership.js.map +1 -1
  125. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts +4 -1
  126. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts.map +1 -1
  127. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js +17 -7
  128. package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js.map +1 -1
  129. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.d.ts +7 -0
  130. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.d.ts.map +1 -1
  131. package/dist/src/services/deployment/k8s/k8s-manifest.schemas.js.map +1 -1
  132. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.d.ts.map +1 -1
  133. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.js +15 -9
  134. package/dist/src/services/deployment/k8s/k8s-secrets-generator.service.js.map +1 -1
  135. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.d.ts +43 -0
  136. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.d.ts.map +1 -0
  137. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.js +12 -0
  138. package/dist/src/services/deployment/k8s/kind-pod-host-gateway.js.map +1 -0
  139. package/dist/src/services/deployment/k8s/off-cluster-backing-services.d.ts +3 -1
  140. package/dist/src/services/deployment/k8s/off-cluster-backing-services.d.ts.map +1 -1
  141. package/dist/src/services/deployment/k8s/off-cluster-backing-services.js.map +1 -1
  142. package/dist/src/services/deployment/local-dev-late-workspace-members.service.d.ts +163 -0
  143. package/dist/src/services/deployment/local-dev-late-workspace-members.service.d.ts.map +1 -0
  144. package/dist/src/services/deployment/local-dev-late-workspace-members.service.js +356 -0
  145. package/dist/src/services/deployment/local-dev-late-workspace-members.service.js.map +1 -0
  146. package/dist/src/services/environment/authored-infra-config.utils.d.ts +13 -3
  147. package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
  148. package/dist/src/services/environment/authored-infra-config.utils.js +24 -4
  149. package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
  150. package/dist/src/services/environment/container-host-gateway-listen-host.d.ts +6 -0
  151. package/dist/src/services/environment/container-host-gateway-listen-host.d.ts.map +1 -1
  152. package/dist/src/services/environment/container-host-gateway-listen-host.js +6 -0
  153. package/dist/src/services/environment/container-host-gateway-listen-host.js.map +1 -1
  154. package/dist/src/services/environment/env-configuration-generator.service.d.ts +12 -0
  155. package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
  156. package/dist/src/services/environment/env-configuration-generator.service.js +37 -5
  157. package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
  158. package/dist/src/services/environment/env-vars-builder.service.d.ts +2 -1
  159. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  160. package/dist/src/services/environment/env-vars-builder.service.js +47 -32
  161. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  162. package/dist/src/services/environment/environment-lifecycle.service.d.ts +7 -4
  163. package/dist/src/services/environment/environment-lifecycle.service.d.ts.map +1 -1
  164. package/dist/src/services/environment/environment-lifecycle.service.js +14 -18
  165. package/dist/src/services/environment/environment-lifecycle.service.js.map +1 -1
  166. package/dist/src/services/environment/environment-setup.service.d.ts.map +1 -1
  167. package/dist/src/services/environment/environment-setup.service.js +17 -6
  168. package/dist/src/services/environment/environment-setup.service.js.map +1 -1
  169. package/dist/src/services/environment/environment.service.d.ts +4 -3
  170. package/dist/src/services/environment/environment.service.d.ts.map +1 -1
  171. package/dist/src/services/environment/environment.service.js +0 -1
  172. package/dist/src/services/environment/environment.service.js.map +1 -1
  173. package/dist/src/services/framework/framework-docker-publish.service.d.ts +55 -15
  174. package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
  175. package/dist/src/services/framework/framework-docker-publish.service.js +115 -25
  176. package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
  177. package/dist/src/services/framework/package-install.service.d.ts +7 -0
  178. package/dist/src/services/framework/package-install.service.d.ts.map +1 -1
  179. package/dist/src/services/framework/package-install.service.js +8 -1
  180. package/dist/src/services/framework/package-install.service.js.map +1 -1
  181. package/dist/src/services/registry/application-provider-connection.service.d.ts +16 -1
  182. package/dist/src/services/registry/application-provider-connection.service.d.ts.map +1 -1
  183. package/dist/src/services/registry/application-provider-connection.service.js +23 -0
  184. package/dist/src/services/registry/application-provider-connection.service.js.map +1 -1
  185. package/dist/src/services/registry/provider-grant-transfer.service.d.ts +48 -0
  186. package/dist/src/services/registry/provider-grant-transfer.service.d.ts.map +1 -0
  187. package/dist/src/services/registry/provider-grant-transfer.service.js +144 -0
  188. package/dist/src/services/registry/provider-grant-transfer.service.js.map +1 -0
  189. package/dist/src/services/registry/provider-module-scaffold.service.d.ts.map +1 -1
  190. package/dist/src/services/registry/provider-module-scaffold.service.js +10 -3
  191. package/dist/src/services/registry/provider-module-scaffold.service.js.map +1 -1
  192. package/dist/src/services/security/csp-sync.service.d.ts.map +1 -1
  193. package/dist/src/services/security/csp-sync.service.js +21 -2
  194. package/dist/src/services/security/csp-sync.service.js.map +1 -1
  195. package/dist/tsconfig.build.tsbuildinfo +1 -1
  196. package/package.json +19 -19
  197. package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +16 -7
  198. package/templates/infra/k8s/platform/platform-crontabs-batches-manager/deployment.yaml.hbs +13 -0
  199. package/templates/saas/i18n/email/system/remote-agent-task-updated/labels.en.ts +11 -0
  200. package/templates/saas/i18n/email/system/remote-agent-task-updated/template.tsx +56 -0
  201. package/templates/saas/i18n/engine/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.ts +61 -0
  202. package/templates/saas/i18n/engine/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.ts +61 -0
  203. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/docusaurus.config.ts.hbs +5 -4
  204. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/package.json.hbs +1 -1
  205. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/scripts/substitute-api-origin.mjs +97 -32
  206. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/plugins/api-reference-pages.ts +7 -6
  207. package/templates/saas/skeleton/.wildo-saas/wildo-dev-companion/scripts/dev-supervised.sh +18 -4
  208. package/templates/saas/skeleton/frontend/nginx-config/default.conf.hbs +1 -1
  209. package/templates/saas/skeleton/frontend/src/generated/csp.generated.json.hbs +4 -4
  210. package/templates/saas/skeleton/infrastructure/local/wildo.infra.local.config.ts.hbs +2 -0
  211. package/wildo-framework.info.json +1 -1
@@ -6,8 +6,8 @@
6
6
  * state persistence.
7
7
  */
8
8
  import { PlatformEnvironmentConfiguration, PlatformEnvOperatingSystem, SetupStatus } from '../../services/environment/environment.schemas';
9
- import { BackingServiceKind, DatabaseEngine, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType, type BackingServicesEnvConfig } from '@wildo-ai/platform-config-lib';
10
- import { PlatformDatabaseChoice, PlatformDataServices } from '../../services/data-services/data-services.schemas';
9
+ import { BackingServiceKind, DatabaseEngine, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType, type BackingServicesEnvConfig, type EnvironmentServiceProfile } from '@wildo-ai/platform-config-lib';
10
+ import { PlatformDatabaseChoice } from '../../services/data-services/data-services.schemas';
11
11
  export declare class EnvironmentLifecycle {
12
12
  static initializeLocal(overrides?: Partial<PlatformEnvironmentConfiguration>): PlatformEnvironmentConfiguration;
13
13
  static initializeEnvironment(name: string, locationType: WildoLocationType, overrides?: Partial<PlatformEnvironmentConfiguration>): PlatformEnvironmentConfiguration;
@@ -124,7 +124,9 @@ export declare class EnvironmentLifecycle {
124
124
  *
125
125
  * - **Mandatory platform dependencies — `redis`, `rabbitmq`, `s3`.** The platform cannot run
126
126
  * without a cache, a broker and an object store: `platform-init` fails closed without
127
- * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. So an undeclared entry means "the framework
127
+ * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. The broker is the exception since #2303 slice D: it is mandatory
128
+ * only while the environment's queue is RabbitMQ (`environmentServiceProfileRunsMessageBroker`), and a profile
129
+ * whose queue lives in the application's database runs none. So an undeclared entry means "the framework
128
130
  * supplies one", which is exactly today's unconditional behaviour and is why this change cannot
129
131
  * delete a workload from any environment that never declared the kind. Only an explicit
130
132
  * `MANAGED` withdraws the local workload — which is the fix. Reading `!== MANAGED` rather than
@@ -150,6 +152,7 @@ export declare class EnvironmentLifecycle {
150
152
  static selfHostsBackingService(env: {
151
153
  name: string;
152
154
  backingServices?: BackingServicesEnvConfig;
155
+ serviceProfile?: EnvironmentServiceProfile;
153
156
  }, kind: BackingServiceKind): boolean;
154
157
  /**
155
158
  * Does this environment USE `kind` and serve it from OUTSIDE its own deployment — a managed database, a managed broker
@@ -169,9 +172,9 @@ export declare class EnvironmentLifecycle {
169
172
  static servesBackingServiceOffCluster(env: {
170
173
  name: string;
171
174
  backingServices?: BackingServicesEnvConfig;
175
+ serviceProfile?: EnvironmentServiceProfile;
172
176
  }, kind: BackingServiceKind): boolean;
173
177
  static getRuntime(envName?: string): WildoDeploymentRuntime;
174
- static getRequiredInfraServices(envName?: string): PlatformDataServices[];
175
178
  static getRequiredPlatformServices(): PlatformWildoServices[];
176
179
  static detectOS(): PlatformEnvOperatingSystem;
177
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environment-lifecycle.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment-lifecycle.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAE1B,WAAW,EACZ,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAwB,cAAc,EAA0B,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAElO,OAAO,EACL,sBAAsB,EAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAA;KAAE,GAAG,OAAO;IASvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAA;KAAE,EACjE,IAAI,EAAE,kBAAkB,GACvB,OAAO;IAgBV;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,8BAA8B,CACnC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAA;KAAE,EACjE,IAAI,EAAE,kBAAkB,GACvB,OAAO;IAuBV,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,sBAAsB;IAS3D,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,oBAAoB,EAAE;IAgBzE,MAAM,CAAC,2BAA2B,IAAI,qBAAqB,EAAE;IAY7D,MAAM,CAAC,QAAQ,IAAI,0BAA0B;CAM9C"}
1
+ {"version":3,"file":"environment-lifecycle.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment-lifecycle.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAE1B,WAAW,EACZ,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAwB,cAAc,EAAsE,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE9S,OAAO,EACL,sBAAsB,EAEvB,MAAM,yDAAyD,C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;OA+CG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAA;KAAE,GAAG,OAAO;IASvG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACH,MAAM,CAAC,uBAAuB,CAC5B,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAC;QAAC,cAAc,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAC7G,IAAI,EAAE,kBAAkB,GACvB,OAAO;IAqBV;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,8BAA8B,CACnC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,wBAAwB,CAAC;QAAC,cAAc,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAC7G,IAAI,EAAE,kBAAkB,GACvB,OAAO;IAyBV,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,sBAAsB;IAS3D,MAAM,CAAC,2BAA2B,IAAI,qBAAqB,EAAE;IAY7D,MAAM,CAAC,QAAQ,IAAI,0BAA0B;CAM9C"}
@@ -6,9 +6,8 @@
6
6
  * state persistence.
7
7
  */
8
8
  import { PlatformEnvOperatingSystem, parsePlatformEnvironmentId, SetupStatus, } from '../../services/environment/environment.schemas.js';
9
- import { BackingServiceKind, BackingServiceSource, DatabaseEngine, PUBLIC_DOMAIN_DEFAULTS, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';
9
+ import { BackingServiceKind, BackingServiceSource, DatabaseEngine, environmentServiceProfileRunsMessageBroker, PUBLIC_DOMAIN_DEFAULTS, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';
10
10
  import { RuntimeEnvironment } from '@wildo-ai/saas-models';
11
- import { PlatformDataServices, } from '../../services/data-services/data-services.schemas.js';
12
11
  import { EnvironmentPaths } from '../../services/environment/environment-paths.service.js';
13
12
  import { EnvironmentRegistry } from '../../services/environment/environment-registry.service.js';
14
13
  import { PlatformRuntimeStateService } from '../../services/environment/platform-runtime-state.service.js';
@@ -257,7 +256,9 @@ export class EnvironmentLifecycle {
257
256
  *
258
257
  * - **Mandatory platform dependencies — `redis`, `rabbitmq`, `s3`.** The platform cannot run
259
258
  * without a cache, a broker and an object store: `platform-init` fails closed without
260
- * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. So an undeclared entry means "the framework
259
+ * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. The broker is the exception since #2303 slice D: it is mandatory
260
+ * only while the environment's queue is RabbitMQ (`environmentServiceProfileRunsMessageBroker`), and a profile
261
+ * whose queue lives in the application's database runs none. So an undeclared entry means "the framework
261
262
  * supplies one", which is exactly today's unconditional behaviour and is why this change cannot
262
263
  * delete a workload from any environment that never declared the kind. Only an explicit
263
264
  * `MANAGED` withdraws the local workload — which is the fix. Reading `!== MANAGED` rather than
@@ -286,8 +287,14 @@ export class EnvironmentLifecycle {
286
287
  return EnvironmentLifecycle.needsLocalMongoDB(env);
287
288
  case BackingServiceKind.POSTGRESQL:
288
289
  return EnvironmentLifecycle.needsLocalPostgreSQL(env);
289
- case BackingServiceKind.REDIS:
290
290
  case BackingServiceKind.RABBITMQ:
291
+ // #2303 slice D — the broker is mandatory only while the environment's queue is RabbitMQ. Under a profile whose
292
+ // queue lives in the application's database it runs no broker at all; the descriptor refuses a declaration
293
+ // beside it, so absence here is the only shape that reaches this.
294
+ if (!environmentServiceProfileRunsMessageBroker(env.serviceProfile))
295
+ return false;
296
+ return env.backingServices?.[kind]?.source !== BackingServiceSource.MANAGED;
297
+ case BackingServiceKind.REDIS:
291
298
  case BackingServiceKind.S3:
292
299
  return env.backingServices?.[kind]?.source !== BackingServiceSource.MANAGED;
293
300
  case BackingServiceKind.CLAMAV:
@@ -313,8 +320,10 @@ export class EnvironmentLifecycle {
313
320
  static servesBackingServiceOffCluster(env, kind) {
314
321
  const declaredManaged = env.backingServices?.[kind]?.source === BackingServiceSource.MANAGED;
315
322
  switch (kind) {
316
- case BackingServiceKind.REDIS:
317
323
  case BackingServiceKind.RABBITMQ:
324
+ // Used at all only while the environment runs a broker (#2303 slice D); then off-cluster exactly when not self-hosted.
325
+ return environmentServiceProfileRunsMessageBroker(env.serviceProfile) && !EnvironmentLifecycle.selfHostsBackingService(env, kind);
326
+ case BackingServiceKind.REDIS:
318
327
  case BackingServiceKind.S3:
319
328
  return !EnvironmentLifecycle.selfHostsBackingService(env, kind);
320
329
  case BackingServiceKind.CLAMAV:
@@ -338,19 +347,6 @@ export class EnvironmentLifecycle {
338
347
  // --------------------------------------------------------------------------
339
348
  // Infrastructure service resolution
340
349
  // --------------------------------------------------------------------------
341
- static getRequiredInfraServices(envName) {
342
- const services = [
343
- PlatformDataServices.VALKEY,
344
- PlatformDataServices.RABBITMQ,
345
- PlatformDataServices.MINIO,
346
- PlatformDataServices.MINIO_INIT,
347
- ];
348
- const name = envName ?? EnvironmentRegistry.getCurrentName();
349
- if (EnvironmentLifecycle.needsLocalMongoDB({ name, backingServices: EnvironmentRegistry.get(name)?.backingServices })) {
350
- services.unshift(PlatformDataServices.MONGODB, PlatformDataServices.MONGODB_INIT);
351
- }
352
- return services;
353
- }
354
350
  static getRequiredPlatformServices() {
355
351
  return [
356
352
  PlatformWildoServices.PLATFORM_INIT,
@@ -1 +1 @@
1
- {"version":3,"file":"environment-lifecycle.service.js","sourceRoot":"","sources":["../../../../src/services/environment/environment-lifecycle.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,0BAA0B,EAC1B,0BAA0B,EAC1B,WAAW,GACZ,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBA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6E;IAC7E,eAAe;IACf,6EAA6E;IAE7E,MAAM,CAAC,QAAQ;QACb,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,QAAQ,KAAK,OAAO;YAAE,OAAO,0BAA0B,CAAC,OAAO,CAAC;QACpE,IAAI,QAAQ,KAAK,QAAQ;YAAE,OAAO,0BAA0B,CAAC,KAAK,CAAC;QACnE,OAAO,0BAA0B,CAAC,KAAK,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\n * EnvironmentLifecycle — initialization, setup status, and domain-specific helpers.\n *\n * Handles environment creation, setup flow tracking, database configuration,\n * and infrastructure service resolution. Depends on EnvironmentRegistry for\n * state persistence.\n */\n\nimport {\n PlatformEnvironmentConfiguration,\n PlatformEnvOperatingSystem,\n parsePlatformEnvironmentId,\n SetupStatus,\n} from '~wildo-cli/services/environment/environment.schemas';\nimport { BackingServiceKind, BackingServiceSource, DatabaseEngine, PUBLIC_DOMAIN_DEFAULTS, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType, type BackingServicesEnvConfig } from '@wildo-ai/platform-config-lib';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport {\n PlatformDatabaseChoice,\n PlatformDataServices,\n} from '~wildo-cli/services/data-services/data-services.schemas';\nimport { EnvironmentPaths } from '~wildo-cli/services/environment/environment-paths.service';\nimport { EnvironmentRegistry } from '~wildo-cli/services/environment/environment-registry.service';\nimport { PlatformRuntimeStateService } from '~wildo-cli/services/environment/platform-runtime-state.service';\n\nexport class EnvironmentLifecycle {\n\n // --------------------------------------------------------------------------\n // Initialization\n // --------------------------------------------------------------------------\n\n static initializeLocal(\n overrides?: Partial<PlatformEnvironmentConfiguration>,\n ): PlatformEnvironmentConfiguration {\n return EnvironmentLifecycle.initializeEnvironment(\n WildoLocationType.LOCAL,\n WildoLocationType.LOCAL,\n overrides,\n );\n }\n\n static initializeEnvironment(\n name: string,\n locationType: WildoLocationType,\n overrides?: Partial<PlatformEnvironmentConfiguration>,\n ): PlatformEnvironmentConfiguration {\n const validatedName = parsePlatformEnvironmentId(name);\n const existing = EnvironmentRegistry.get(validatedName);\n if (existing) return existing;\n\n const now = new Date().toISOString();\n const defaultDatabase = {\n engine: DatabaseEngine.MONGODB,\n source: BackingServiceSource.SELF,\n };\n const seededRuntime = overrides?.runtime ?? WildoDeploymentRuntime.DOCKER_COMPOSE;\n // `publicDomain` is required on `PlatformEnvironmentConfiguration`\n // (mirrors the schema-required `WildoInfraEnvConfig.publicDomain`).\n // For the local-init path the canonical write-time default depends\n // on the seeded runtime; remote callers MUST pass an explicit\n // `publicDomain` override (no remote default exists).\n const seededPublicDomain = overrides?.publicDomain\n ?? (locationType === WildoLocationType.LOCAL\n ? (seededRuntime === WildoDeploymentRuntime.KUBERNETES\n ? PUBLIC_DOMAIN_DEFAULTS.LOCAL_K8S\n : PUBLIC_DOMAIN_DEFAULTS.LOCAL_COMPOSE)\n : undefined);\n if (!seededPublicDomain) {\n throw new Error(\n `EnvironmentLifecycle.initializeEnvironment: '${validatedName}' (remote) must be initialized with an explicit publicDomain override.`,\n );\n }\n const env: PlatformEnvironmentConfiguration = {\n name: validatedName,\n locationType,\n runtime: seededRuntime,\n runtimeEnvironment: overrides?.runtimeEnvironment\n ?? (locationType === WildoLocationType.LOCAL ? RuntimeEnvironment.DEVELOPMENT : undefined),\n os: EnvironmentLifecycle.detectOS(),\n secretsPath: overrides?.secretsPath ?? EnvironmentPaths.resolveDefaultSecretsBase(),\n configPath: overrides?.configPath ?? EnvironmentPaths.resolveDefaultConfigBase(),\n infraPath: overrides?.infraPath ?? EnvironmentPaths.resolveDefaultInfraBase(),\n database: overrides?.database ?? defaultDatabase,\n publicDomain: seededPublicDomain,\n setupStatus: overrides?.setupStatus ?? SetupStatus.NOT_STARTED,\n createdAt: overrides?.createdAt ?? now,\n updatedAt: overrides?.updatedAt ?? now,\n ...overrides,\n };\n\n EnvironmentRegistry.insert(env);\n return env;\n }\n\n // --------------------------------------------------------------------------\n // Batch update (from full env config object)\n // --------------------------------------------------------------------------\n\n static updateEnvironmentState(env: PlatformEnvironmentConfiguration): void {\n EnvironmentRegistry.update(env.name, {\n runtime: env.runtime,\n runtimeEnvironment: env.runtimeEnvironment,\n /*\n * Same defence-in-depth as the public-identity trio below: `config.json` stays the on-disk\n * source of truth and every reader reconciles through `hydrateEnvironmentFromConfig`, but an\n * explicit projection like this one drops whatever it does not list, and a registry record\n * that silently lost the storage mode would report a shape the running stack does not have.\n */\n localDataStorage: env.localDataStorage,\n // Same defence-in-depth as `localDataStorage`: an explicit projection drops what it does not list (#2303).\n serviceProfile: env.serviceProfile,\n secretsPath: env.secretsPath,\n configPath: env.configPath,\n infraPath: env.infraPath,\n database: env.database,\n infrastructureHost: env.infrastructureHost,\n publicDomain: env.publicDomain,\n /**\n * The edge SCHEME and its certificate travel WITH the domain — the three together are the\n * environment's public identity, and a record carrying one without the others describes a\n * host nobody is served on.\n *\n * Persisting them is defence in depth, not the primary mechanism: `config.json` remains the\n * on-disk source of truth and every generator reconciles against it through\n * `hydrateEnvironmentFromConfig`. But omitting them here made the registry actively\n * misleading rather than merely partial — a reader saw `publicDomain: 'localhost'` with no\n * scheme and could not tell \"http\" from \"never round-tripped\", which is exactly the reading\n * that produced an http topology for a TLS dev edge on 2026-08-13.\n */\n kubernetes: env.kubernetes,\n backingServices: env.backingServices,\n serviceAuth: env.serviceAuth,\n });\n }\n\n // --------------------------------------------------------------------------\n // Setup status\n // --------------------------------------------------------------------------\n\n static getSetupStatus(envName?: string): SetupStatus {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.setupStatus ?? SetupStatus.NOT_STARTED;\n }\n\n static setSetupStatus(status: SetupStatus, envName?: string): void {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n const updates: Partial<PlatformEnvironmentConfiguration> = { setupStatus: status };\n if (status === SetupStatus.COMPLETED) {\n updates.setupCompletedAt = new Date().toISOString();\n }\n EnvironmentRegistry.update(name, updates);\n }\n\n static isSetupCompleted(envName?: string): boolean {\n return EnvironmentLifecycle.getSetupStatus(envName) === SetupStatus.COMPLETED;\n }\n\n // --------------------------------------------------------------------------\n // Platform initialization (apps-manager INIT mode)\n // --------------------------------------------------------------------------\n\n static isPlatformInitialized(envName?: string): boolean {\n return PlatformRuntimeStateService.isPlatformInitialized(envName);\n }\n\n static markPlatformInitialized(envName?: string): void {\n PlatformRuntimeStateService.markPlatformInitialized(envName);\n }\n\n static clearPlatformInitialized(envName?: string): void {\n PlatformRuntimeStateService.clearPlatformInitialized(envName);\n }\n\n // --------------------------------------------------------------------------\n // Database helpers\n // --------------------------------------------------------------------------\n\n static getDatabaseChoice(envName?: string): PlatformDatabaseChoice {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.database ?? {\n engine: DatabaseEngine.MONGODB,\n source: BackingServiceSource.SELF,\n };\n }\n\n static getDatabaseEngine(envName?: string): DatabaseEngine {\n return EnvironmentLifecycle.getDatabaseChoice(envName).engine;\n }\n\n static setDatabaseChoice(database: PlatformDatabaseChoice, envName?: string): void {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n EnvironmentRegistry.update(name, { database });\n }\n\n /**\n * Should this environment self-deploy a MongoDB container?\n *\n * A UNION of the two ways an environment can ask for one — the exact mirror of\n * {@link needsLocalPostgreSQL}, and made a union for the mirror-image reason (Phase 5.1, D7):\n * once the PLATFORM engine moves to PostgreSQL, `engine === MONGODB` goes false — but a\n * transition environment still runs every Mongo-backed APPLICATION it always ran, and deleting\n * mongod from under them because the platform moved is the same inexpressibility defect the\n * PostgreSQL gate had, with the stores swapped. Dual-store environments are a first-class state.\n *\n * - platform half: the environment's own database engine is self-hosted MongoDB (unchanged\n * meaning — Atlas/MANAGED envs still get no local mongod);\n * - authored half: `backingServices.mongodb: { source: SELF }` in `wildo.infra.<env>.config.ts`,\n * which composes with ANY platform engine.\n *\n * Takes the env structurally (name + authored `backingServices` snapshot) for the same freshness\n * reason as the PostgreSQL predicate; name-only callers build the shape from the registry.\n */\n static needsLocalMongoDB(env: { name: string; backingServices?: BackingServicesEnvConfig }): boolean {\n const db = EnvironmentLifecycle.getDatabaseChoice(env.name);\n const platformEngineIsSelfHostedMongo = db.engine === DatabaseEngine.MONGODB && db.source === BackingServiceSource.SELF;\n const authorDeclaredSelfHostedMongo = env.backingServices?.[BackingServiceKind.MONGODB]?.source === BackingServiceSource.SELF;\n return platformEngineIsSelfHostedMongo || authorDeclaredSelfHostedMongo;\n }\n\n /**\n * Should this environment self-deploy a PostgreSQL container?\n *\n * ## Why this is not simply `getDatabaseEngine() === POSTGRESQL`\n *\n * `database.engine` is the PLATFORM's own database choice, and it is EXCLUSIVE with MongoDB by\n * construction: {@link needsLocalMongoDB}'s PLATFORM half is `engine === MONGODB && source === SELF`\n * (since Phase 5.1 it is a union with an authored `backingServices.mongodb` half — a transition\n * env keeps mongod for its Mongo-backed apps after the platform engine moves), so selecting\n * PostgreSQL there removes MongoDB from the rendered compose file entirely. That is correct for\n * what the field means — apps-manager stores `APPLICATION_ID` as a Mongo `_id`, so the platform\n * control plane IS Mongo-backed — but it left no way to express the configuration an application\n * on the PostgreSQL persistence adapter actually needs: **MongoDB for the platform, PostgreSQL for\n * the application's own resources.** Both containers, at once.\n *\n * Until this predicate existed, PostgreSQL was the ONE self-hosted service in the compose template\n * not gated on its own declaration. Every sibling reads `backingServices.<kind>.source === SELF`\n * (`resolveIncludeLocalClamAV`, `resolveIncludeLocalImmudb`, and MongoDB above). PostgreSQL read a\n * field that also subtracts a different service, which is why no environment could ever have one.\n *\n * So the rule is a UNION of the two ways an environment can ask for a local PostgreSQL:\n *\n * - the platform's own database engine is PostgreSQL and self-hosted — the pre-existing meaning,\n * preserved exactly;\n * - the env author declared `backingServices.postgresql: { source: SELF }` in\n * `wildo.infra.<env>.config.ts` — the additive meaning, which composes with any platform engine.\n *\n * `source === SELF` is required on BOTH halves. The engine half previously ignored `source`, so a\n * MANAGED PostgreSQL (an external RDS) would still have spawned a local container. Requiring SELF\n * matches {@link needsLocalMongoDB} and every sibling resolver; it is unreachable as a behaviour\n * change today because the only CLI path that writes `engine: POSTGRESQL` also writes\n * `source: SELF`.\n *\n * Takes the env STRUCTURALLY (name + the in-memory authored `backingServices` snapshot) rather\n * than a name alone, because the authored snapshot is what the compose generator and the K8s\n * catalog both hold and it can be fresher than the persisted registry entry — the same shape\n * `getDeployableInfraServicesForK8s` already accepts for exactly that reason.\n *\n * Single source of truth for the four sites that ask this question:\n * - `renderDockerComposeTemplate`'s `includePostgreSQL` context value;\n * - `getDockerComposeLocalDataServices` (whether `local_data/postgresql/` must be pre-created);\n * - `getDeployableInfraServicesForK8s` (Compose ⇄ K8s parity);\n * - `shouldProvisionPostgreSQL` in `env-vars-builder.service.ts` (whether env files carry the\n * PostgreSQL admin credentials — half of its union rule). That site used to keep the bare\n * engine predicate this JSDoc rejects, so the compose file rendered a postgres service whose\n * `POSTGRES_ADMIN_PASSWORD` was never emitted (2026-08-11: crash-looping container, failed\n * `wildo local dev`). A fifth site must reuse one of these, never re-derive.\n */\n static needsLocalPostgreSQL(env: { name: string; backingServices?: BackingServicesEnvConfig }): boolean {\n const db = EnvironmentLifecycle.getDatabaseChoice(env.name);\n const platformEngineIsSelfHostedPostgres =\n db.engine === DatabaseEngine.POSTGRESQL && db.source === BackingServiceSource.SELF;\n const authorDeclaredSelfHostedPostgres =\n env.backingServices?.[BackingServiceKind.POSTGRESQL]?.source === BackingServiceSource.SELF;\n return platformEngineIsSelfHostedPostgres || authorDeclaredSelfHostedPostgres;\n }\n\n /**\n * Does this environment run its OWN workload for `kind` — a Compose container or a K8s\n * StatefulSet — as opposed to pointing at somebody else's endpoint?\n *\n * ## Why this exists as ONE total function\n *\n * `backingServices.<kind>.source` is the author's statement of the hosting model, and the whole\n * point of `MANAGED` is that the operator supplies the instance. Until this function existed,\n * three of the nine kinds ignored that statement entirely: `redis`, `rabbitmq` and `s3` were\n * pushed unconditionally by BOTH lanes (`getDockerComposeLocalDataServices` and\n * `getDeployableInfraServicesForK8s`), so declaring `redis: { source: MANAGED }` deployed a local\n * Valkey container beside the managed cache and the operator paid for both. `postgresql` had the\n * same shape on the K8s side only.\n *\n * The defect was never that any one condition was wrong — each of the four gated kinds\n * (`mongodb`, `postgresql` on Compose, `clamav`, `immudb`) reads its own declaration correctly. It\n * was that \"is this kind self-hosted?\" had no single owner, so a kind could be added — or an\n * emission site written — without anyone deciding. Hence a `switch` with NO `default` branch and\n * an explicit `: boolean` return type: a member added to {@link BackingServiceKind} tomorrow makes\n * this function fall off its end and fails the build (TS2366) until someone answers the question\n * for it. That is the assert; there is deliberately no second hand-written list to keep in step.\n *\n * ## The answers, and why an OMITTED entry is not one rule\n *\n * `backingServices` keys are optional by design (a flattened app declaration stays truthful about\n * what it enables), so absence is a real input and it means different things per kind:\n *\n * - **Mandatory platform dependencies — `redis`, `rabbitmq`, `s3`.** The platform cannot run\n * without a cache, a broker and an object store: `platform-init` fails closed without\n * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. So an undeclared entry means \"the framework\n * supplies one\", which is exactly today's unconditional behaviour and is why this change cannot\n * delete a workload from any environment that never declared the kind. Only an explicit\n * `MANAGED` withdraws the local workload — which is the fix. Reading `!== MANAGED` rather than\n * `=== SELF` is the whole distinction, and it is deliberate: `=== SELF` would silently drop the\n * three containers from every environment whose file predates the `backingServices` block.\n * - **Optional capabilities — `clamav`, `immudb`.** Nothing runs them unless asked, so absence\n * means no workload and only `SELF` produces one. Unchanged from\n * `resolveIncludeLocalClamAV` / `resolveIncludeLocalImmudb`, which now delegate here.\n *\n * There used to be a third answer, \"no workload at all\", for `metrics-telemetry` and `backup`. Both\n * kinds were WITHDRAWN (2026-09-09 and 2026-09-26, #476 and #1693) because nothing read them.\n *\n * This predicate answers WORKLOAD inclusion only. A `MANAGED` cache, broker or object store is still\n * correctly answered `false` here, and is independently REFUSED at authoring time while no provider\n * module can serve it (`findUnservableBackingServiceDeclarations`, #1693).\n *\n * `mongodb` and `postgresql` are neither: each is a UNION with the PLATFORM's own engine choice\n * (`database.engine`), which lives in the registry rather than in `backingServices`. They delegate\n * to the two predicates that already own that union — never re-derive it here.\n *\n * @param kind the backing service being asked about — every member of the enum is answerable.\n */\n static selfHostsBackingService(\n env: { name: string; backingServices?: BackingServicesEnvConfig },\n kind: BackingServiceKind,\n ): boolean {\n switch (kind) {\n case BackingServiceKind.MONGODB:\n return EnvironmentLifecycle.needsLocalMongoDB(env);\n case BackingServiceKind.POSTGRESQL:\n return EnvironmentLifecycle.needsLocalPostgreSQL(env);\n case BackingServiceKind.REDIS:\n case BackingServiceKind.RABBITMQ:\n case BackingServiceKind.S3:\n return env.backingServices?.[kind]?.source !== BackingServiceSource.MANAGED;\n case BackingServiceKind.CLAMAV:\n case BackingServiceKind.IMMUDB:\n return env.backingServices?.[kind]?.source === BackingServiceSource.SELF;\n }\n }\n\n /**\n * Does this environment USE `kind` and serve it from OUTSIDE its own deployment — a managed database, a managed broker\n * — so that the runtimes dialling it leave the cluster (#3511)?\n *\n * The complement of {@link selfHostsBackingService} within the kinds the environment uses at all, which is why it is\n * not simply `!selfHostsBackingService`: an optional capability nobody declared (`clamav`, `immudb`) is neither\n * self-hosted nor served from elsewhere, and a store no part of the platform uses is not reached anywhere. Answered\n * per kind, with the same no-`default` switch, so a kind added tomorrow fails the build here too:\n *\n * - **`redis`, `rabbitmq`, `s3`** are always used (mandatory platform dependencies), so they are off-cluster exactly\n * when not self-hosted, i.e. declared `MANAGED`.\n * - **`clamav`, `immudb`** are used only when declared, so only a declared `MANAGED` is off-cluster.\n * - **`mongodb`, `postgresql`** are used when the platform's own engine is that store (whatever its source) or the\n * author declares the kind, and are off-cluster when used and not self-hosted.\n */\n static servesBackingServiceOffCluster(\n env: { name: string; backingServices?: BackingServicesEnvConfig },\n kind: BackingServiceKind,\n ): boolean {\n const declaredManaged = env.backingServices?.[kind]?.source === BackingServiceSource.MANAGED;\n switch (kind) {\n case BackingServiceKind.REDIS:\n case BackingServiceKind.RABBITMQ:\n case BackingServiceKind.S3:\n return !EnvironmentLifecycle.selfHostsBackingService(env, kind);\n case BackingServiceKind.CLAMAV:\n case BackingServiceKind.IMMUDB:\n return declaredManaged;\n case BackingServiceKind.MONGODB:\n case BackingServiceKind.POSTGRESQL: {\n const engine = kind === BackingServiceKind.MONGODB ? DatabaseEngine.MONGODB : DatabaseEngine.POSTGRESQL;\n const used = EnvironmentLifecycle.getDatabaseChoice(env.name).engine === engine || env.backingServices?.[kind] !== undefined;\n return used && !EnvironmentLifecycle.selfHostsBackingService(env, kind);\n }\n }\n }\n\n // --------------------------------------------------------------------------\n // Runtime\n // --------------------------------------------------------------------------\n\n static getRuntime(envName?: string): WildoDeploymentRuntime {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.runtime ?? WildoDeploymentRuntime.DOCKER_COMPOSE;\n }\n\n // --------------------------------------------------------------------------\n // Infrastructure service resolution\n // --------------------------------------------------------------------------\n\n static getRequiredInfraServices(envName?: string): PlatformDataServices[] {\n const services: PlatformDataServices[] = [\n PlatformDataServices.VALKEY,\n PlatformDataServices.RABBITMQ,\n PlatformDataServices.MINIO,\n PlatformDataServices.MINIO_INIT,\n ];\n\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n if (EnvironmentLifecycle.needsLocalMongoDB({ name, backingServices: EnvironmentRegistry.get(name)?.backingServices })) {\n services.unshift(PlatformDataServices.MONGODB, PlatformDataServices.MONGODB_INIT);\n }\n\n return services;\n }\n\n static getRequiredPlatformServices(): PlatformWildoServices[] {\n return [\n PlatformWildoServices.PLATFORM_INIT,\n PlatformWildoServices.APPS_MANAGER,\n PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n ];\n }\n\n // --------------------------------------------------------------------------\n // OS detection\n // --------------------------------------------------------------------------\n\n static detectOS(): PlatformEnvOperatingSystem {\n const platform = process.platform;\n if (platform === 'win32') return PlatformEnvOperatingSystem.WINDOWS;\n if (platform === 'darwin') return PlatformEnvOperatingSystem.MACOS;\n return PlatformEnvOperatingSystem.LINUX;\n }\n}\n"]}
1
+ {"version":3,"file":"environment-lifecycle.service.js","sourceRoot":"","sources":["../../../../src/services/environment/environment-lifecycle.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,0BAA0B,EAC1B,0BAA0B,EAC1B,WAAW,GACZ,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,0CAA0C,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAiE,MAAM,+BAA+B,CAAC;AAC9S,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gEAAgE,CAAC;AAE7G,MAAM,OAAO,oBAAoB;IAE/B,6EAA6E;IAC7E,iBAAiB;IACjB,6EAA6E;IAE7E,MAAM,CAAC,eAAe,CACpB,SAAqD;QAErD,OAAO,oBAAoB,CAAC,qBAAqB,CAC/C,iBAAiB,CAAC,KAAK,EACvB,iBAAiB,CAAC,KAAK,EACvB,SAAS,CACV,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,qBAAqB,CAC1B,IAAY,EACZ,YAA+B,EAC/B,SAAqD;QAErD,MAAM,aAAa,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACxD,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,eAAe,GAAG;YACtB,MAAM,EAAE,cAAc,CAAC,OAAO;YAC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,OAAO;YACL,qBAAqB,CAAC,aAAa;YACnC,qBAAqB,CAAC,YAAY;YAClC,qBAAqB,CAAC,wBAAwB;SAC/C,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,eAAe;IACf,6EAA6E;IAE7E,MAAM,CAAC,QAAQ;QACb,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,QAAQ,KAAK,OAAO;YAAE,OAAO,0BAA0B,CAAC,OAAO,CAAC;QACpE,IAAI,QAAQ,KAAK,QAAQ;YAAE,OAAO,0BAA0B,CAAC,KAAK,CAAC;QACnE,OAAO,0BAA0B,CAAC,KAAK,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\n * EnvironmentLifecycle — initialization, setup status, and domain-specific helpers.\n *\n * Handles environment creation, setup flow tracking, database configuration,\n * and infrastructure service resolution. Depends on EnvironmentRegistry for\n * state persistence.\n */\n\nimport {\n PlatformEnvironmentConfiguration,\n PlatformEnvOperatingSystem,\n parsePlatformEnvironmentId,\n SetupStatus,\n} from '~wildo-cli/services/environment/environment.schemas';\nimport { BackingServiceKind, BackingServiceSource, DatabaseEngine, environmentServiceProfileRunsMessageBroker, PUBLIC_DOMAIN_DEFAULTS, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType, type BackingServicesEnvConfig, type EnvironmentServiceProfile } from '@wildo-ai/platform-config-lib';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport {\n PlatformDatabaseChoice,\n PlatformDataServices,\n} from '~wildo-cli/services/data-services/data-services.schemas';\nimport { EnvironmentPaths } from '~wildo-cli/services/environment/environment-paths.service';\nimport { EnvironmentRegistry } from '~wildo-cli/services/environment/environment-registry.service';\nimport { PlatformRuntimeStateService } from '~wildo-cli/services/environment/platform-runtime-state.service';\n\nexport class EnvironmentLifecycle {\n\n // --------------------------------------------------------------------------\n // Initialization\n // --------------------------------------------------------------------------\n\n static initializeLocal(\n overrides?: Partial<PlatformEnvironmentConfiguration>,\n ): PlatformEnvironmentConfiguration {\n return EnvironmentLifecycle.initializeEnvironment(\n WildoLocationType.LOCAL,\n WildoLocationType.LOCAL,\n overrides,\n );\n }\n\n static initializeEnvironment(\n name: string,\n locationType: WildoLocationType,\n overrides?: Partial<PlatformEnvironmentConfiguration>,\n ): PlatformEnvironmentConfiguration {\n const validatedName = parsePlatformEnvironmentId(name);\n const existing = EnvironmentRegistry.get(validatedName);\n if (existing) return existing;\n\n const now = new Date().toISOString();\n const defaultDatabase = {\n engine: DatabaseEngine.MONGODB,\n source: BackingServiceSource.SELF,\n };\n const seededRuntime = overrides?.runtime ?? WildoDeploymentRuntime.DOCKER_COMPOSE;\n // `publicDomain` is required on `PlatformEnvironmentConfiguration`\n // (mirrors the schema-required `WildoInfraEnvConfig.publicDomain`).\n // For the local-init path the canonical write-time default depends\n // on the seeded runtime; remote callers MUST pass an explicit\n // `publicDomain` override (no remote default exists).\n const seededPublicDomain = overrides?.publicDomain\n ?? (locationType === WildoLocationType.LOCAL\n ? (seededRuntime === WildoDeploymentRuntime.KUBERNETES\n ? PUBLIC_DOMAIN_DEFAULTS.LOCAL_K8S\n : PUBLIC_DOMAIN_DEFAULTS.LOCAL_COMPOSE)\n : undefined);\n if (!seededPublicDomain) {\n throw new Error(\n `EnvironmentLifecycle.initializeEnvironment: '${validatedName}' (remote) must be initialized with an explicit publicDomain override.`,\n );\n }\n const env: PlatformEnvironmentConfiguration = {\n name: validatedName,\n locationType,\n runtime: seededRuntime,\n runtimeEnvironment: overrides?.runtimeEnvironment\n ?? (locationType === WildoLocationType.LOCAL ? RuntimeEnvironment.DEVELOPMENT : undefined),\n os: EnvironmentLifecycle.detectOS(),\n secretsPath: overrides?.secretsPath ?? EnvironmentPaths.resolveDefaultSecretsBase(),\n configPath: overrides?.configPath ?? EnvironmentPaths.resolveDefaultConfigBase(),\n infraPath: overrides?.infraPath ?? EnvironmentPaths.resolveDefaultInfraBase(),\n database: overrides?.database ?? defaultDatabase,\n publicDomain: seededPublicDomain,\n setupStatus: overrides?.setupStatus ?? SetupStatus.NOT_STARTED,\n createdAt: overrides?.createdAt ?? now,\n updatedAt: overrides?.updatedAt ?? now,\n ...overrides,\n };\n\n EnvironmentRegistry.insert(env);\n return env;\n }\n\n // --------------------------------------------------------------------------\n // Batch update (from full env config object)\n // --------------------------------------------------------------------------\n\n static updateEnvironmentState(env: PlatformEnvironmentConfiguration): void {\n EnvironmentRegistry.update(env.name, {\n runtime: env.runtime,\n runtimeEnvironment: env.runtimeEnvironment,\n /*\n * Same defence-in-depth as the public-identity trio below: `config.json` stays the on-disk\n * source of truth and every reader reconciles through `hydrateEnvironmentFromConfig`, but an\n * explicit projection like this one drops whatever it does not list, and a registry record\n * that silently lost the storage mode would report a shape the running stack does not have.\n */\n localDataStorage: env.localDataStorage,\n // Same defence-in-depth as `localDataStorage`: an explicit projection drops what it does not list (#2303).\n serviceProfile: env.serviceProfile,\n secretsPath: env.secretsPath,\n configPath: env.configPath,\n infraPath: env.infraPath,\n database: env.database,\n infrastructureHost: env.infrastructureHost,\n publicDomain: env.publicDomain,\n /**\n * The edge SCHEME and its certificate travel WITH the domain — the three together are the\n * environment's public identity, and a record carrying one without the others describes a\n * host nobody is served on.\n *\n * Persisting them is defence in depth, not the primary mechanism: `config.json` remains the\n * on-disk source of truth and every generator reconciles against it through\n * `hydrateEnvironmentFromConfig`. But omitting them here made the registry actively\n * misleading rather than merely partial — a reader saw `publicDomain: 'localhost'` with no\n * scheme and could not tell \"http\" from \"never round-tripped\", which is exactly the reading\n * that produced an http topology for a TLS dev edge on 2026-08-13.\n */\n kubernetes: env.kubernetes,\n backingServices: env.backingServices,\n serviceAuth: env.serviceAuth,\n });\n }\n\n // --------------------------------------------------------------------------\n // Setup status\n // --------------------------------------------------------------------------\n\n static getSetupStatus(envName?: string): SetupStatus {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.setupStatus ?? SetupStatus.NOT_STARTED;\n }\n\n static setSetupStatus(status: SetupStatus, envName?: string): void {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n const updates: Partial<PlatformEnvironmentConfiguration> = { setupStatus: status };\n if (status === SetupStatus.COMPLETED) {\n updates.setupCompletedAt = new Date().toISOString();\n }\n EnvironmentRegistry.update(name, updates);\n }\n\n static isSetupCompleted(envName?: string): boolean {\n return EnvironmentLifecycle.getSetupStatus(envName) === SetupStatus.COMPLETED;\n }\n\n // --------------------------------------------------------------------------\n // Platform initialization (apps-manager INIT mode)\n // --------------------------------------------------------------------------\n\n static isPlatformInitialized(envName?: string): boolean {\n return PlatformRuntimeStateService.isPlatformInitialized(envName);\n }\n\n static markPlatformInitialized(envName?: string): void {\n PlatformRuntimeStateService.markPlatformInitialized(envName);\n }\n\n static clearPlatformInitialized(envName?: string): void {\n PlatformRuntimeStateService.clearPlatformInitialized(envName);\n }\n\n // --------------------------------------------------------------------------\n // Database helpers\n // --------------------------------------------------------------------------\n\n static getDatabaseChoice(envName?: string): PlatformDatabaseChoice {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.database ?? {\n engine: DatabaseEngine.MONGODB,\n source: BackingServiceSource.SELF,\n };\n }\n\n static getDatabaseEngine(envName?: string): DatabaseEngine {\n return EnvironmentLifecycle.getDatabaseChoice(envName).engine;\n }\n\n static setDatabaseChoice(database: PlatformDatabaseChoice, envName?: string): void {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n EnvironmentRegistry.update(name, { database });\n }\n\n /**\n * Should this environment self-deploy a MongoDB container?\n *\n * A UNION of the two ways an environment can ask for one — the exact mirror of\n * {@link needsLocalPostgreSQL}, and made a union for the mirror-image reason (Phase 5.1, D7):\n * once the PLATFORM engine moves to PostgreSQL, `engine === MONGODB` goes false — but a\n * transition environment still runs every Mongo-backed APPLICATION it always ran, and deleting\n * mongod from under them because the platform moved is the same inexpressibility defect the\n * PostgreSQL gate had, with the stores swapped. Dual-store environments are a first-class state.\n *\n * - platform half: the environment's own database engine is self-hosted MongoDB (unchanged\n * meaning — Atlas/MANAGED envs still get no local mongod);\n * - authored half: `backingServices.mongodb: { source: SELF }` in `wildo.infra.<env>.config.ts`,\n * which composes with ANY platform engine.\n *\n * Takes the env structurally (name + authored `backingServices` snapshot) for the same freshness\n * reason as the PostgreSQL predicate; name-only callers build the shape from the registry.\n */\n static needsLocalMongoDB(env: { name: string; backingServices?: BackingServicesEnvConfig }): boolean {\n const db = EnvironmentLifecycle.getDatabaseChoice(env.name);\n const platformEngineIsSelfHostedMongo = db.engine === DatabaseEngine.MONGODB && db.source === BackingServiceSource.SELF;\n const authorDeclaredSelfHostedMongo = env.backingServices?.[BackingServiceKind.MONGODB]?.source === BackingServiceSource.SELF;\n return platformEngineIsSelfHostedMongo || authorDeclaredSelfHostedMongo;\n }\n\n /**\n * Should this environment self-deploy a PostgreSQL container?\n *\n * ## Why this is not simply `getDatabaseEngine() === POSTGRESQL`\n *\n * `database.engine` is the PLATFORM's own database choice, and it is EXCLUSIVE with MongoDB by\n * construction: {@link needsLocalMongoDB}'s PLATFORM half is `engine === MONGODB && source === SELF`\n * (since Phase 5.1 it is a union with an authored `backingServices.mongodb` half — a transition\n * env keeps mongod for its Mongo-backed apps after the platform engine moves), so selecting\n * PostgreSQL there removes MongoDB from the rendered compose file entirely. That is correct for\n * what the field means — apps-manager stores `APPLICATION_ID` as a Mongo `_id`, so the platform\n * control plane IS Mongo-backed — but it left no way to express the configuration an application\n * on the PostgreSQL persistence adapter actually needs: **MongoDB for the platform, PostgreSQL for\n * the application's own resources.** Both containers, at once.\n *\n * Until this predicate existed, PostgreSQL was the ONE self-hosted service in the compose template\n * not gated on its own declaration. Every sibling reads `backingServices.<kind>.source === SELF`\n * (`resolveIncludeLocalClamAV`, `resolveIncludeLocalImmudb`, and MongoDB above). PostgreSQL read a\n * field that also subtracts a different service, which is why no environment could ever have one.\n *\n * So the rule is a UNION of the two ways an environment can ask for a local PostgreSQL:\n *\n * - the platform's own database engine is PostgreSQL and self-hosted — the pre-existing meaning,\n * preserved exactly;\n * - the env author declared `backingServices.postgresql: { source: SELF }` in\n * `wildo.infra.<env>.config.ts` — the additive meaning, which composes with any platform engine.\n *\n * `source === SELF` is required on BOTH halves. The engine half previously ignored `source`, so a\n * MANAGED PostgreSQL (an external RDS) would still have spawned a local container. Requiring SELF\n * matches {@link needsLocalMongoDB} and every sibling resolver; it is unreachable as a behaviour\n * change today because the only CLI path that writes `engine: POSTGRESQL` also writes\n * `source: SELF`.\n *\n * Takes the env STRUCTURALLY (name + the in-memory authored `backingServices` snapshot) rather\n * than a name alone, because the authored snapshot is what the compose generator and the K8s\n * catalog both hold and it can be fresher than the persisted registry entry — the same shape\n * `getDeployableInfraServicesForK8s` already accepts for exactly that reason.\n *\n * Single source of truth for the four sites that ask this question:\n * - `renderDockerComposeTemplate`'s `includePostgreSQL` context value;\n * - `getDockerComposeLocalDataServices` (whether `local_data/postgresql/` must be pre-created);\n * - `getDeployableInfraServicesForK8s` (Compose ⇄ K8s parity);\n * - `shouldProvisionPostgreSQL` in `env-vars-builder.service.ts` (whether env files carry the\n * PostgreSQL admin credentials — half of its union rule). That site used to keep the bare\n * engine predicate this JSDoc rejects, so the compose file rendered a postgres service whose\n * `POSTGRES_ADMIN_PASSWORD` was never emitted (2026-08-11: crash-looping container, failed\n * `wildo local dev`). A fifth site must reuse one of these, never re-derive.\n */\n static needsLocalPostgreSQL(env: { name: string; backingServices?: BackingServicesEnvConfig }): boolean {\n const db = EnvironmentLifecycle.getDatabaseChoice(env.name);\n const platformEngineIsSelfHostedPostgres =\n db.engine === DatabaseEngine.POSTGRESQL && db.source === BackingServiceSource.SELF;\n const authorDeclaredSelfHostedPostgres =\n env.backingServices?.[BackingServiceKind.POSTGRESQL]?.source === BackingServiceSource.SELF;\n return platformEngineIsSelfHostedPostgres || authorDeclaredSelfHostedPostgres;\n }\n\n /**\n * Does this environment run its OWN workload for `kind` — a Compose container or a K8s\n * StatefulSet — as opposed to pointing at somebody else's endpoint?\n *\n * ## Why this exists as ONE total function\n *\n * `backingServices.<kind>.source` is the author's statement of the hosting model, and the whole\n * point of `MANAGED` is that the operator supplies the instance. Until this function existed,\n * three of the nine kinds ignored that statement entirely: `redis`, `rabbitmq` and `s3` were\n * pushed unconditionally by BOTH lanes (`getDockerComposeLocalDataServices` and\n * `getDeployableInfraServicesForK8s`), so declaring `redis: { source: MANAGED }` deployed a local\n * Valkey container beside the managed cache and the operator paid for both. `postgresql` had the\n * same shape on the K8s side only.\n *\n * The defect was never that any one condition was wrong — each of the four gated kinds\n * (`mongodb`, `postgresql` on Compose, `clamav`, `immudb`) reads its own declaration correctly. It\n * was that \"is this kind self-hosted?\" had no single owner, so a kind could be added — or an\n * emission site written — without anyone deciding. Hence a `switch` with NO `default` branch and\n * an explicit `: boolean` return type: a member added to {@link BackingServiceKind} tomorrow makes\n * this function fall off its end and fails the build (TS2366) until someone answers the question\n * for it. That is the assert; there is deliberately no second hand-written list to keep in step.\n *\n * ## The answers, and why an OMITTED entry is not one rule\n *\n * `backingServices` keys are optional by design (a flattened app declaration stays truthful about\n * what it enables), so absence is a real input and it means different things per kind:\n *\n * - **Mandatory platform dependencies — `redis`, `rabbitmq`, `s3`.** The platform cannot run\n * without a cache, a broker and an object store: `platform-init` fails closed without\n * `REDIS_HOST` / `RABBITMQ_HOST` / `STORAGE_*`. The broker is the exception since #2303 slice D: it is mandatory\n * only while the environment's queue is RabbitMQ (`environmentServiceProfileRunsMessageBroker`), and a profile\n * whose queue lives in the application's database runs none. So an undeclared entry means \"the framework\n * supplies one\", which is exactly today's unconditional behaviour and is why this change cannot\n * delete a workload from any environment that never declared the kind. Only an explicit\n * `MANAGED` withdraws the local workload — which is the fix. Reading `!== MANAGED` rather than\n * `=== SELF` is the whole distinction, and it is deliberate: `=== SELF` would silently drop the\n * three containers from every environment whose file predates the `backingServices` block.\n * - **Optional capabilities — `clamav`, `immudb`.** Nothing runs them unless asked, so absence\n * means no workload and only `SELF` produces one. Unchanged from\n * `resolveIncludeLocalClamAV` / `resolveIncludeLocalImmudb`, which now delegate here.\n *\n * There used to be a third answer, \"no workload at all\", for `metrics-telemetry` and `backup`. Both\n * kinds were WITHDRAWN (2026-09-09 and 2026-09-26, #476 and #1693) because nothing read them.\n *\n * This predicate answers WORKLOAD inclusion only. A `MANAGED` cache, broker or object store is still\n * correctly answered `false` here, and is independently REFUSED at authoring time while no provider\n * module can serve it (`findUnservableBackingServiceDeclarations`, #1693).\n *\n * `mongodb` and `postgresql` are neither: each is a UNION with the PLATFORM's own engine choice\n * (`database.engine`), which lives in the registry rather than in `backingServices`. They delegate\n * to the two predicates that already own that union — never re-derive it here.\n *\n * @param kind the backing service being asked about — every member of the enum is answerable.\n */\n static selfHostsBackingService(\n env: { name: string; backingServices?: BackingServicesEnvConfig; serviceProfile?: EnvironmentServiceProfile },\n kind: BackingServiceKind,\n ): boolean {\n switch (kind) {\n case BackingServiceKind.MONGODB:\n return EnvironmentLifecycle.needsLocalMongoDB(env);\n case BackingServiceKind.POSTGRESQL:\n return EnvironmentLifecycle.needsLocalPostgreSQL(env);\n case BackingServiceKind.RABBITMQ:\n // #2303 slice D — the broker is mandatory only while the environment's queue is RabbitMQ. Under a profile whose\n // queue lives in the application's database it runs no broker at all; the descriptor refuses a declaration\n // beside it, so absence here is the only shape that reaches this.\n if (!environmentServiceProfileRunsMessageBroker(env.serviceProfile)) return false;\n return env.backingServices?.[kind]?.source !== BackingServiceSource.MANAGED;\n case BackingServiceKind.REDIS:\n case BackingServiceKind.S3:\n return env.backingServices?.[kind]?.source !== BackingServiceSource.MANAGED;\n case BackingServiceKind.CLAMAV:\n case BackingServiceKind.IMMUDB:\n return env.backingServices?.[kind]?.source === BackingServiceSource.SELF;\n }\n }\n\n /**\n * Does this environment USE `kind` and serve it from OUTSIDE its own deployment — a managed database, a managed broker\n * — so that the runtimes dialling it leave the cluster (#3511)?\n *\n * The complement of {@link selfHostsBackingService} within the kinds the environment uses at all, which is why it is\n * not simply `!selfHostsBackingService`: an optional capability nobody declared (`clamav`, `immudb`) is neither\n * self-hosted nor served from elsewhere, and a store no part of the platform uses is not reached anywhere. Answered\n * per kind, with the same no-`default` switch, so a kind added tomorrow fails the build here too:\n *\n * - **`redis`, `rabbitmq`, `s3`** are always used (mandatory platform dependencies), so they are off-cluster exactly\n * when not self-hosted, i.e. declared `MANAGED`.\n * - **`clamav`, `immudb`** are used only when declared, so only a declared `MANAGED` is off-cluster.\n * - **`mongodb`, `postgresql`** are used when the platform's own engine is that store (whatever its source) or the\n * author declares the kind, and are off-cluster when used and not self-hosted.\n */\n static servesBackingServiceOffCluster(\n env: { name: string; backingServices?: BackingServicesEnvConfig; serviceProfile?: EnvironmentServiceProfile },\n kind: BackingServiceKind,\n ): boolean {\n const declaredManaged = env.backingServices?.[kind]?.source === BackingServiceSource.MANAGED;\n switch (kind) {\n case BackingServiceKind.RABBITMQ:\n // Used at all only while the environment runs a broker (#2303 slice D); then off-cluster exactly when not self-hosted.\n return environmentServiceProfileRunsMessageBroker(env.serviceProfile) && !EnvironmentLifecycle.selfHostsBackingService(env, kind);\n case BackingServiceKind.REDIS:\n case BackingServiceKind.S3:\n return !EnvironmentLifecycle.selfHostsBackingService(env, kind);\n case BackingServiceKind.CLAMAV:\n case BackingServiceKind.IMMUDB:\n return declaredManaged;\n case BackingServiceKind.MONGODB:\n case BackingServiceKind.POSTGRESQL: {\n const engine = kind === BackingServiceKind.MONGODB ? DatabaseEngine.MONGODB : DatabaseEngine.POSTGRESQL;\n const used = EnvironmentLifecycle.getDatabaseChoice(env.name).engine === engine || env.backingServices?.[kind] !== undefined;\n return used && !EnvironmentLifecycle.selfHostsBackingService(env, kind);\n }\n }\n }\n\n // --------------------------------------------------------------------------\n // Runtime\n // --------------------------------------------------------------------------\n\n static getRuntime(envName?: string): WildoDeploymentRuntime {\n const name = envName ?? EnvironmentRegistry.getCurrentName();\n return EnvironmentRegistry.get(name)?.runtime ?? WildoDeploymentRuntime.DOCKER_COMPOSE;\n }\n\n // --------------------------------------------------------------------------\n // Infrastructure service resolution\n // --------------------------------------------------------------------------\n\n static getRequiredPlatformServices(): PlatformWildoServices[] {\n return [\n PlatformWildoServices.PLATFORM_INIT,\n PlatformWildoServices.APPS_MANAGER,\n PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n ];\n }\n\n // --------------------------------------------------------------------------\n // OS detection\n // --------------------------------------------------------------------------\n\n static detectOS(): PlatformEnvOperatingSystem {\n const platform = process.platform;\n if (platform === 'win32') return PlatformEnvOperatingSystem.WINDOWS;\n if (platform === 'darwin') return PlatformEnvOperatingSystem.MACOS;\n return PlatformEnvOperatingSystem.LINUX;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"environment-setup.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment-setup.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAItG,OAAO,EAOL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AA0BtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,WAAW,CAAC,CAmXtB"}
1
+ {"version":3,"file":"environment-setup.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment-setup.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAKtG,OAAO,EAQL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AA0BtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,WAAW,CAAC,CAsXtB"}
@@ -1,8 +1,9 @@
1
1
  import chalk from 'chalk';
2
2
  import { confirm } from '@inquirer/prompts';
3
3
  import { EnvironmentUtils } from '../../services/environment/environment.service.js';
4
+ import { EnvironmentLifecycle } from '../../services/environment/environment-lifecycle.service.js';
4
5
  import { SetupStatus } from '../../services/environment/environment.schemas.js';
5
- import { BackingServiceSource, DatabaseEngine, K8S_LOCAL_DEFAULTS, KIND_CLUSTER_DEFAULTS, PUBLIC_DOMAIN_DEFAULTS, WildoDeploymentRuntime, WildoLocationType, } from '@wildo-ai/platform-config-lib';
6
+ import { BackingServiceKind, BackingServiceSource, DatabaseEngine, K8S_LOCAL_DEFAULTS, KIND_CLUSTER_DEFAULTS, PUBLIC_DOMAIN_DEFAULTS, WildoDeploymentRuntime, WildoLocationType, } from '@wildo-ai/platform-config-lib';
6
7
  import { ContextManager } from '../../services/context/context-manager.service.js';
7
8
  import { applyProviderKeyDefaults, DEFAULT_PROVIDER_KEY_DEFAULTS_MODE, resolveProviderKeyDefaultsAdoption, } from '../../services/credentials/local-defaults.service.js';
8
9
  import { runtimeModule } from '../../modules/domain/environment/runtime-selector.module.js';
@@ -244,7 +245,11 @@ export async function runEnvSetup(envName, locationType, options, log) {
244
245
  // the one thing a headless caller genuinely must state (see `resolveAdminUserFromEnvSeeds`).
245
246
  // Reconfiguration may add an approver or provider key, but is never credential rotation.
246
247
  // Read after path selection so this is the store the writer will actually update.
247
- const existingSecrets = readSetupSecrets(EnvironmentPaths.resolveSecretsDir(envName));
248
+ // A hosted application's file holds only its own sections, so it is read as such; the authored descriptor decides.
249
+ const authoredForEnv = await loadAuthoredInfraEnvConfig(envName, saasRoot);
250
+ const existingSecrets = readSetupSecrets(EnvironmentPaths.resolveSecretsDir(envName), {
251
+ hosted: authoredForEnv?.config.infrastructureHost !== undefined,
252
+ });
248
253
  const adminAnswers = existingSecrets?.admin ?? (options.nonInteractive
249
254
  ? resolveAdminUserFromEnvSeeds(log)
250
255
  : await platformAdminUserModule.prompt({ log }));
@@ -347,7 +352,6 @@ export async function runEnvSetup(envName, locationType, options, log) {
347
352
  // `env.backingServices?.clamav?.source === SELF` in the docker-compose
348
353
  // generator). Loading the authored descriptor here keeps setup honoring
349
354
  // the operator's authored choices.
350
- const authoredForEnv = await loadAuthoredInfraEnvConfig(envName, saasRoot);
351
355
  if (authoredForEnv) {
352
356
  env.backingServices = authoredForEnv.config.backingServices;
353
357
  env.serviceAuth = authoredForEnv.config.serviceAuth;
@@ -422,13 +426,20 @@ function printSetupSummary(log, env, platformImageRef, isFrameworkDeveloper, adm
422
426
  if (runtime === WildoDeploymentRuntime.KUBERNETES) {
423
427
  log.info(` K8s namespace: ${env.kubernetes?.namespace}`);
424
428
  }
425
- const mongoSuffix = isLocalDb ? ', mongodb' : '';
429
+ // Derived from the same rule the lanes render from, so the summary cannot list a service the profile drops (#2303).
430
+ // Called on `EnvironmentLifecycle` itself, not the `EnvironmentUtils` facade, which tests replace with a partial mock.
431
+ const infraServices = [
432
+ ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.REDIS) ? ['valkey'] : []),
433
+ ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.RABBITMQ) ? ['rabbitmq'] : []),
434
+ ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.S3) ? ['minio'] : []),
435
+ ...(isLocalDb ? ['mongodb'] : []),
436
+ ].join(', ') || 'none';
426
437
  if (isFrameworkDeveloper) {
427
- log.info(`\n Infra services: valkey, rabbitmq, minio${mongoSuffix}`);
438
+ log.info(`\n Infra services: ${infraServices}`);
428
439
  log.info(` Platform services: run natively (hot-reload)`);
429
440
  }
430
441
  else {
431
- log.info(`\n Infra services: valkey, rabbitmq, minio${mongoSuffix}`);
442
+ log.info(`\n Infra services: ${infraServices}`);
432
443
  log.info(` Platform services: apps-manager, crontabs-batches-manager, module-registry (Docker containers)`);
433
444
  log.info(` Docker image: ${platformImageRef} (pulled from Docker Hub)`);
434
445
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environment-setup.service.js","sourceRoot":"","sources":["../../../../src/services/environment/environment-setup.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAoC,WAAW,EAAE,MAAM,qDAAqD,CAAC;AACpH,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AACrF,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,GACnC,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAAE,aAAa,EAAE,MAAM,+DAA+D,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,oCAAoC,EAAE,MAAM,8DAA8D,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAChI,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kEAAkE,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAC7H,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,EAAE,e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ClD,GAAG,CAAC,IAAI,CAAC,2BAA2B,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,IAAI,oBAAoB,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC,oDAAoD,WAAW,EAAE,CAAC,CAAC;QAC5E,GAAG,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,oDAAoD,WAAW,EAAE,CAAC,CAAC;QAC5E,GAAG,CAAC,IAAI,CAAC,sGAAsG,CAAC,CAAC;QACjH,GAAG,CAAC,IAAI,CAAC,2BAA2B,gBAAgB,2BAA2B,CAAC,CAAC;IACnF,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACf,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { confirm } from '@inquirer/prompts';\n\nimport type { EnvSetupInput, SetupResult } from '~wildo-cli/services/environment/environment.schemas';\nimport type { ProviderKeysInput } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { PlatformEnvironmentConfiguration, SetupStatus } from '~wildo-cli/services/environment/environment.schemas';\nimport {\n BackingServiceSource,\n DatabaseEngine,\n K8S_LOCAL_DEFAULTS,\n KIND_CLUSTER_DEFAULTS,\n PUBLIC_DOMAIN_DEFAULTS,\n WildoDeploymentRuntime,\n WildoLocationType,\n} from '@wildo-ai/platform-config-lib';\nimport { ContextManager } from '~wildo-cli/services/context/context-manager.service';\nimport {\n applyProviderKeyDefaults,\n DEFAULT_PROVIDER_KEY_DEFAULTS_MODE,\n resolveProviderKeyDefaultsAdoption,\n} from '~wildo-cli/services/credentials/local-defaults.service';\nimport type { Logger } from '~wildo-cli/kernel/types';\n\nimport type { PathsConfig, RuntimeChoice } from '~wildo-cli/modules/domain/environment/module.types';\nimport type { DatabaseInitializationInput } from '~wildo-cli/services/data-services/data-services.schemas';\nimport { runtimeModule } from '~wildo-cli/modules/domain/environment/runtime-selector.module';\nimport { runtimeSemanticsModule } from '~wildo-cli/modules/domain/environment/runtime-semantics.module';\nimport { platformPathsModule } from '~wildo-cli/modules/domain/environment/paths-config.module';\nimport { platformDatabaseInitializationModule } from '~wildo-cli/modules/domain/environment/database-config.module';\nimport { platformAdminUserModule, resolveAdminUserFromEnvSeeds } from '~wildo-cli/modules/domain/credentials/admin-user.module';\nimport { resolveApproverIdentity } from '~wildo-cli/modules/domain/credentials/approver-user.module';\nimport { establishCreationEssentials } from '~wildo-cli/modules/domain/credentials/creation-essentials.module';\nimport { buildCredentials, readSetupSecrets, runSecretsWrite } from '~wildo-cli/services/credentials/secrets-writer.service';\nimport { getProviderSelectionCatalog } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { runInfraWrite } from '~wildo-cli/services/deployment/infra-writer.service';\nimport { runK8sBootstrap } from '~wildo-cli/services/deployment/k8s/k8s-bootstrap.service';\nimport { resolvePlatformImageRef } from '~wildo-cli/services/environment/platform-runtime.schemas';\nimport { readVersion } from '~wildo-cli/kernel/bootstrap';\nimport { EnvironmentPaths } from '~wildo-cli/services/environment/environment-paths.service';\nimport { loadAuthoredInfraEnvConfig } from '~wildo-cli/services/environment/authored-infra-config.utils';\n\n\n// NOTE: This service currently mixes interactive prompts (module calls) with\n// business logic (file writes). The interactive input collection should be\n// extracted to a command-layer pattern (using BaseCommand.prompt()), leaving\n// only non-interactive execution here.\n\n/**\n * Core environment setup flow — env-agnostic. Drives `wildo setup`.\n *\n * Two modes, ONE write path (Phase 2 below is identical for both — only how the answers are\n * OBTAINED differs, which is the point: a headless bootstrap must not be a second, drifting\n * implementation of setup):\n *\n * - **Interactive** (default) — the operator answers each module's prompts.\n * - **Non-interactive** (`options.nonInteractive`, i.e. `wildo setup --non-interactive`) — every\n * answer is DERIVED, never asked:\n * - runtime / runtimeEnvironment / paths / database ← the registered environment, which\n * `ExistingAppBootstrapService.ensureLocalEnvironment` projects from the authored\n * `wildo.infra.<env>.config.ts` at kernel bootstrap (`initializeEnvironment` returns that\n * existing registration untouched). The authored descriptor is the declaration of record —\n * a prompt could only contradict it.\n * - admin identity ← the `WILDO_INIT_ADMIN_*` env seeds, fail-closed when absent.\n * - provider API keys ← none (all optional).\n * - every credential (Mongo/Valkey/RabbitMQ/storage/platform secrets, the appsManager EC\n * keypair, and the admin password when unseeded) ← GENERATED by {@link buildCredentials}.\n * This is what makes a cold, unattended VM bootstrappable: `secrets.json` has no other minter,\n * and without it `local up` cannot write `.env.wildo-platform`. Non-interactive is IDEMPOTENT —\n * an already-COMPLETED setup is a no-op success unless `force` is set.\n */\nexport async function runEnvSetup(\n envName: string,\n locationType: WildoLocationType,\n options: EnvSetupInput,\n log: Logger,\n): Promise<SetupResult> {\n const cliContext = ContextManager.get();\n const preferences = cliContext.preferences;\n if (!preferences) {\n log.error(chalk.red('\\n No preferences found. Run the install script first.\\n'));\n return { success: false };\n }\n\n /*\n * The machine preference is a DEFAULT, not a verdict.\n *\n * It decides whether the platform services run natively from the checkout or as containers of the\n * published image, and one machine can legitimately host both kinds of environment. Resolved once\n * here so every later read sees the same answer; `preferences.isFrameworkDeveloper` is not read\n * directly below.\n */\n const isFrameworkDeveloper = options.frameworkDeveloper ?? preferences.isFrameworkDeveloper;\n\n const saasRoot = cliContext.resolvedHomes.app.declarationRoot;\n if (!saasRoot) {\n log.error(chalk.red('\\n No targeted app root detected.\\n'));\n return { success: false };\n }\n const frameworkPath = cliContext.resolvedHomes.framework.repositoryRoot;\n if (!frameworkPath) {\n log.error(chalk.red(\n '\\n No framework repository root detected. '\n + 'Re-run the CLI install script or set frameworkPath in your machine preferences.\\n',\n ));\n return { success: false };\n }\n const env = EnvironmentUtils.initializeEnvironment(envName, locationType, {\n secretsPath: EnvironmentPaths.resolveScopedSecretsBase(saasRoot),\n configPath: EnvironmentPaths.resolveScopedConfigBase(saasRoot),\n infraPath: EnvironmentPaths.resolveScopedInfraBase(saasRoot),\n });\n const previousSetupStatus = env.setupStatus;\n\n const isFirstTime = env.setupStatus !== SetupStatus.COMPLETED || options.force;\n\n if (!isFirstTime) {\n log.info(chalk.dim('\\n Existing setup detected.\\n'));\n printCurrentSummary(log, env);\n\n // Non-interactive is IDEMPOTENT: an already-COMPLETED setup is a no-op success, so a headless\n // lane (CI, a scripted re-provision) can call `wildo setup --non-interactive` unconditionally\n // on every run. Re-minting would rotate secrets.json — orphaning the Mongo/Valkey data those\n // credentials already protect and invalidating a running stack. `--force` re-authors configuration\n // while the credential writer preserves existing identities and generated material.\n if (options.nonInteractive) {\n log.info(chalk.dim(' Non-interactive: keeping the existing setup (pass --force to re-author).\\n'));\n return { success: true };\n }\n\n const reconfigure = await confirm({\n message: 'Reconfigure?',\n default: false,\n });\n\n if (!reconfigure) {\n log.info(chalk.dim('\\n Keeping current configuration.\\n'));\n return { success: true };\n }\n }\n\n EnvironmentUtils.setSetupStatus(SetupStatus.IN_PROGRESS, envName);\n\n try {\n // Step 1 — Paths\n log.info(chalk.cyan('\\n Step 1/6 — Storage Paths\\n'));\n const pathsCtx = {\n envName,\n saasRoot,\n isFirstTime,\n isFrameworkDeveloper: isFrameworkDeveloper,\n frameworkPath,\n currentSecrets: env.secretsPath,\n currentConfig: env.configPath,\n log,\n };\n // Non-interactive: the environment registration ALREADY carries resolved paths —\n // `ExistingAppBootstrapService.ensureLocalEnvironment` seeds them from the app root (or a\n // detected sibling wildo-secrets repo) at kernel bootstrap, and `initializeEnvironment`\n // returns that existing registration untouched. The prompt exists only to OFFER a sibling\n // repo / a custom location; neither is a headless decision, so we honor what is registered.\n /*\n * A supplied path ANSWERS step 1 and skips the prompt for that one value only. This is how an\n * environment joins a shared secrets location without an operator walking the wizard — the\n * prompt's own purpose, per its docstring, is to \"OFFER a sibling repo / a custom location\".\n */\n const pathOverrides = {\n ...(options.secretsPath === undefined ? {} : { secretsPath: options.secretsPath }),\n ...(options.configPath === undefined ? {} : { configPath: options.configPath }),\n ...(options.infraPath === undefined ? {} : { infraPath: options.infraPath }),\n };\n const answeredEveryPath = options.secretsPath !== undefined\n && options.configPath !== undefined\n && options.infraPath !== undefined;\n const pathsAnswers: PathsConfig = options.nonInteractive || answeredEveryPath\n ? {\n secretsPath: env.secretsPath,\n configPath: env.configPath,\n infraPath: env.infraPath,\n ...pathOverrides,\n }\n : { ...(await platformPathsModule.prompt(pathsCtx)), ...pathOverrides };\n await platformPathsModule.apply?.(pathsAnswers, pathsCtx);\n env.secretsPath = pathsAnswers.secretsPath;\n env.configPath = pathsAnswers.configPath;\n env.infraPath = pathsAnswers.infraPath;\n\n // Step 2 — Local platform question\n log.info('');\n // Non-interactive callers are bootstrapping a local platform BY DEFINITION (that is the only\n // thing this flow mints secrets for) — asking would be theatre, so it is an implicit yes.\n const wantsLocalPlatform = options.nonInteractive || await confirm({\n message: `Set up a local Wildo development platform?\n\n This will run infrastructure services (MongoDB, Valkey, RabbitMQ, etc.)\n locally using Docker, and bootstrap the Wildo platform for development.\n\n Set up local platform?`,\n default: true,\n });\n\n if (!wantsLocalPlatform) {\n log.info(chalk.dim('\\n Skipping local platform setup. CLI tools are still available.\\n'));\n EnvironmentUtils.setSetupStatus(SetupStatus.COMPLETED, envName);\n return { success: true };\n }\n\n // Step 3 — Runtime\n log.info(chalk.cyan('\\n Step 2/6 — Infrastructure Runtime\\n'));\n // Non-interactive: the AUTHORED `wildo.infra.<env>.config.ts` already DECLARES the runtime\n // (projected onto the registration by `ensureLocalEnvironment`). Re-asking would let an\n // operator's answer contradict the committed declaration — the authored file is the truth.\n const requestedRuntime = options.runtime === undefined\n ? undefined\n : Object.values(WildoDeploymentRuntime).find((candidate) => candidate === options.runtime);\n if (options.runtime !== undefined && requestedRuntime === undefined) {\n log.error(chalk.red(`\\n Invalid --runtime \"${options.runtime}\". Valid: ${Object.values(WildoDeploymentRuntime).join(', ')}\\n`));\n return { success: false };\n }\n const runtimeAnswers: RuntimeChoice = requestedRuntime !== undefined\n ? { runtime: requestedRuntime }\n : options.nonInteractive\n ? { runtime: env.runtime }\n : await runtimeModule.prompt({\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n env.runtime = runtimeAnswers.runtime;\n // Seed top-level `publicDomain` based on the runtime the operator\n // just chose. Required by the schema; for local interactive setup\n // the canonical write-time defaults from `PUBLIC_DOMAIN_DEFAULTS`\n // give the operator a working starting point that they can edit\n // afterwards in `wildo.infra.local.config.ts`.\n env.publicDomain = runtimeAnswers.runtime === WildoDeploymentRuntime.KUBERNETES\n ? PUBLIC_DOMAIN_DEFAULTS.LOCAL_K8S\n : PUBLIC_DOMAIN_DEFAULTS.LOCAL_COMPOSE;\n if (runtimeAnswers.runtime === WildoDeploymentRuntime.KUBERNETES) {\n env.kubernetes = {\n namespace: K8S_LOCAL_DEFAULTS.NAMESPACE,\n imageRegistry: `localhost:${KIND_CLUSTER_DEFAULTS.REGISTRY_PORT}`,\n };\n }\n\n // Step 4 — Runtime semantics\n log.info(chalk.cyan('\\n Step 3/6 — Application Runtime Semantics\\n'));\n const runtimeSemanticsAnswers = options.nonInteractive\n ? { runtimeEnvironment: env.runtimeEnvironment }\n : await runtimeSemanticsModule.prompt({ locationType });\n env.runtimeEnvironment = runtimeSemanticsAnswers.runtimeEnvironment;\n\n // Step 5 — Database\n log.info(chalk.cyan('\\n Step 4/6 — Database\\n'));\n // Non-interactive: `ensureLocalEnvironment` already resolved the AUTHORITATIVE database choice\n // from the authored infra descriptor's `backingServices` (falling back to self-hosted Mongo), so\n // the registration is the answer. The prompt's other branch (an external Atlas instance + its API\n // keys) is inherently interactive material and is NOT a headless-bootstrap scenario — a lane that\n // needs it must author it in `wildo.infra.<env>.config.ts` instead of answering a prompt.\n /*\n * `--database` answers the ENGINE and nothing else. The prompt's other branch — an external Atlas\n * instance and its API keys — is inherently interactive material, so a flag that claimed to answer\n * the whole step would be lying about the half it cannot carry.\n */\n const requestedEngine = options.database === undefined\n ? undefined\n : Object.values(DatabaseEngine).find((candidate) => candidate === options.database);\n if (options.database !== undefined && requestedEngine === undefined) {\n log.error(chalk.red(`\\n Invalid --database \"${options.database}\". Valid: ${Object.values(DatabaseEngine).join(', ')}\\n`));\n return { success: false };\n }\n const dbAnswers: DatabaseInitializationInput = requestedEngine !== undefined\n ? { database: { ...env.database, engine: requestedEngine } }\n : options.nonInteractive\n ? { database: env.database }\n : await platformDatabaseInitializationModule.prompt({\n envName,\n log,\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n await platformDatabaseInitializationModule.apply?.(dbAnswers, {\n envName,\n log,\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n env.database = dbAnswers.database;\n\n // Step 6 — Admin\n log.info(chalk.cyan('\\n Step 5/6 — Platform Administrator\\n'));\n // Non-interactive: identity from the `WILDO_INIT_ADMIN_*` env seeds, FAIL-CLOSED when absent —\n // the one thing a headless caller genuinely must state (see `resolveAdminUserFromEnvSeeds`).\n // Reconfiguration may add an approver or provider key, but is never credential rotation.\n // Read after path selection so this is the store the writer will actually update.\n const existingSecrets = readSetupSecrets(EnvironmentPaths.resolveSecretsDir(envName));\n const adminAnswers = existingSecrets?.admin ?? (options.nonInteractive\n ? resolveAdminUserFromEnvSeeds(log)\n : await platformAdminUserModule.prompt({ log }));\n const approverAnswers = existingSecrets?.approver ?? resolveApproverIdentity({\n admin: adminAnswers,\n isLocalEnvironment: locationType === WildoLocationType.LOCAL,\n log,\n }).approver;\n\n // Step 7 — What development needs\n log.info(chalk.cyan('\\n Step 6/6 — Coding agent and LLM\\n'));\n /*\n * ONLY what development cannot start without (#1637, decided by Paul 2026-09-25): the coding\n * agent's login and the companion's LLM key. This step used to offer every provider in the\n * catalogue, whatever the application enabled; every other secret is now asked when something\n * first needs it — `wildo secrets set <NAME>`, or the workbench's secrets section.\n *\n * Non-interactive: nothing is typed; a missing login or key is REPORTED with the command that\n * fixes it, never refused — a headless lane supplies keys through its own secret store.\n */\n /*\n * ADOPT this machine's captured provider keys before asking for any.\n *\n * The headless branch used to answer `{}`, so an unattended setup produced an environment with NO\n * third-party credentials at all — correct when nothing had ever been captured, and needless\n * retyping once something had. Adoption fills it from `~/.wildo/local-defaults.json`, and the\n * prompt still runs interactively for anything the file does not carry.\n *\n * Only the PROVIDER-KEY half is decided here (`--provider-key-defaults`): setup never adopts the\n * shared platform credentials, so the `--local-defaults` it used to take governed provider keys\n * under the other half's name. See \"Two halves, two decisions\" in local-defaults.service.ts.\n */\n const providerKeyMode = options.providerKeyDefaults === undefined || options.providerKeyDefaults === ''\n ? preferences.defaults?.providerKeyDefaults ?? DEFAULT_PROVIDER_KEY_DEFAULTS_MODE\n : options.providerKeyDefaults;\n const offeredProviderEnv = await resolveProviderKeyDefaultsAdoption({\n mode: providerKeyMode,\n canAsk: options.nonInteractive !== true && process.stdin.isTTY === true,\n confirm: (names) => confirm({ message: `Use the provider keys captured on this machine (${names.join(', ')})?`, default: true }),\n }) ?? {};\n /*\n * SEED, never replace: only keys this environment does not already hold. Merged below over the existing\n * `providerEnv`, an adopted key would otherwise silently undo a key rotated with `wildo secrets set` on\n * any re-run of setup — and ADOPT, the default, no longer asks first. Same rule as init's draft.\n */\n const seededNames = applyProviderKeyDefaults({ providerEnv: { ...(existingSecrets?.providerEnv ?? {}) } }, offeredProviderEnv);\n const adoptedProviderEnv: Record<string, string> = Object.fromEntries(seededNames.map((name) => [name, offeredProviderEnv[name]!]));\n\n const essentials = await establishCreationEssentials({\n log,\n interactive: options.nonInteractive !== true && process.stdin.isTTY === true,\n saasRoot,\n // Names only: the essentials ask whether the LLM key is set, never what it is.\n storedProviderEnvNames: new Set(Object.entries({ ...(existingSecrets?.providerEnv ?? {}), ...adoptedProviderEnv })\n .filter(([, value]) => value.trim().length > 0)\n .map(([name]) => name)),\n codingAgentPreference: preferences.defaults?.codingAgent,\n });\n const promptedProviderAnswers: ProviderKeysInput = Object.keys(essentials.providerEnv).length === 0\n ? {}\n : { providerEnv: essentials.providerEnv };\n /*\n * The PROMPT wins over the adopted value: somebody typing a key on this run means it, and a\n * machine default must never silently replace an explicit answer.\n */\n const mergedProviderEnv = { ...adoptedProviderEnv, ...(promptedProviderAnswers.providerEnv ?? {}) };\n const providerAnswers: ProviderKeysInput = {\n ...promptedProviderAnswers,\n // OMITTED when empty rather than written as `{}`: a headless run that adopted nothing must\n // produce exactly what it produced before this existed, key for key.\n ...(Object.keys(mergedProviderEnv).length === 0 ? {} : { providerEnv: mergedProviderEnv }),\n };\n\n // Step 7 — Confirmation summary\n /*\n * The platform image is not a setup input: every lane that runs a platform container runs the\n * published `docker.io/wildoai/wildo-platform:<framework version>`, and a framework developer runs the\n * platform natively (`resolvePlatformImageRef`). Until 2026-09-06 setup handed `latest` to the renderer\n * for both lanes, so every app-creator `wildo setup` re-rendered the compose file to a `:latest` nobody\n * had promised to publish; until #2988 it still handed `latest` to a framework developer's render, for a\n * platform container their compose file never contains.\n */\n const platformImageRef = resolvePlatformImageRef({ frameworkVersion: readVersion() });\n\n log.info('');\n printSetupSummary(log, env, platformImageRef, isFrameworkDeveloper, adminAnswers, providerAnswers);\n\n // Non-interactive: the summary above is printed for the CI log, but there is nobody to confirm —\n // the caller already committed by passing --non-interactive.\n const proceed = options.nonInteractive || await confirm({ message: 'Proceed?', default: true });\n if (!proceed) {\n EnvironmentUtils.setSetupStatus(previousSetupStatus, envName);\n log.warn(chalk.yellow('\\n Setup cancelled.\\n'));\n return { success: false };\n }\n\n // --- Phase 2: File generation ---\n log.info(chalk.cyan('\\n Phase 2 — Generating configuration files...\\n'));\n\n const credentials = buildCredentials(adminAnswers, dbAnswers, providerAnswers, approverAnswers, existingSecrets ?? undefined);\n\n // Seed `env.backingServices` / `serviceAuth` / `logging` from the authored\n // `wildo.infra.<env>.config.ts` BEFORE rendering compose. The wizard's\n // prompts only cover paths/runtime/database — they don't touch the\n // authored backing-services map. Without this seed, the compose template\n // is rendered against an `env` whose `backingServices` is `undefined`,\n // which silently DROPS opt-in services like `clamav` (gated on\n // `env.backingServices?.clamav?.source === SELF` in the docker-compose\n // generator). Loading the authored descriptor here keeps setup honoring\n // the operator's authored choices.\n const authoredForEnv = await loadAuthoredInfraEnvConfig(envName, saasRoot);\n if (authoredForEnv) {\n env.backingServices = authoredForEnv.config.backingServices;\n env.serviceAuth = authoredForEnv.config.serviceAuth;\n env.logging = authoredForEnv.config.logging;\n env.infrastructureHost = authoredForEnv.config.infrastructureHost;\n }\n // Persisted BEFORE the secrets write below: the single secrets writer decides from the registry whether this\n // environment is hosted, and a hosted file must receive only its application-owned sections.\n if (env.infrastructureHost !== undefined) {\n EnvironmentUtils.updateEnvironmentState(env);\n }\n\n await runSecretsWrite(env, credentials, dbAnswers, log, authoredForEnv?.config);\n await runInfraWrite(env, frameworkPath, isFrameworkDeveloper, credentials, log);\n\n EnvironmentUtils.updateEnvironmentState(env);\n EnvironmentUtils.setSetupStatus(SetupStatus.COMPLETED, envName);\n log.success(chalk.green(' ✓ environments.json updated'));\n\n log.success(chalk.green('\\n Phase 2 complete — configuration files generated.\\n'));\n\n // --- Phase 3: K8s deployment (if applicable) ---\n // A hosted environment's cluster is its host's: bootstrapping it from here would delete and recreate it.\n if (env.runtime === WildoDeploymentRuntime.KUBERNETES && env.infrastructureHost === undefined) {\n const k8sResult = await runK8sBootstrap(\n env,\n frameworkPath,\n credentials,\n {\n reset: true,\n isFrameworkDeveloper: isFrameworkDeveloper,\n saasRoot,\n },\n log,\n );\n if (!k8sResult.success) {\n return { success: false };\n }\n }\n\n return { success: true, adminPassword: credentials.admin!.password };\n } catch (error) {\n EnvironmentUtils.setSetupStatus(SetupStatus.FAILED, envName);\n throw error;\n }\n}\n\n\nfunction printCurrentSummary(log: Logger, env: PlatformEnvironmentConfiguration): void {\n log.info(` Secrets path: ${env.secretsPath}`);\n log.info(` Config path: ${env.configPath}`);\n log.info(` Infra path: ${env.infraPath}`);\n log.info(` App semantics: ${env.runtimeEnvironment ?? 'not set'}`);\n log.info(` Database: ${env.database.engine} — ${env.database.source}`);\n log.info(` Setup status: ${env.setupStatus}`);\n}\n\nfunction printSetupSummary(\n log: Logger,\n env: PlatformEnvironmentConfiguration,\n platformImageRef: string,\n isFrameworkDeveloper: boolean,\n admin: { email: string; firstName: string; lastName: string },\n providers: ProviderKeysInput,\n): void {\n // A provider counts as configured when any of its declared secrets was\n // supplied; map the collected env-var names back to provider labels via the\n // same registry-derived catalog the setup selector uses.\n const configuredEnvVars = new Set(Object.keys(providers.providerEnv ?? {}));\n const providerNames = getProviderSelectionCatalog()\n .filter((entry) => entry.secrets.some((secret) => configuredEnvVars.has(secret.envVarName)))\n .map((entry) => entry.label);\n if (providers.githubOrgUrl) {\n providerNames.push('GitHub organization');\n }\n\n const runtime = env.runtime;\n const runtimeLabel = runtime === WildoDeploymentRuntime.DOCKER_COMPOSE ? 'Docker Compose' : 'Kubernetes';\n const isLocalDb = env.database.source === BackingServiceSource.SELF;\n const dbLabel = isLocalDb ? 'Local (Docker)' : 'Atlas (external)';\n\n log.info(chalk.bold(' Configuration summary:\\n'));\n log.info(` Secrets path: ${env.secretsPath}`);\n log.info(` Config path: ${env.configPath}`);\n log.info(` Infra path: ${env.infraPath}`);\n log.info(` Local platform: Yes`);\n log.info(` Runtime: ${runtimeLabel}`);\n log.info(` App semantics: ${env.runtimeEnvironment ?? 'not set'}`);\n log.info(` Database: ${env.database.engine} — ${dbLabel}`);\n log.info(` Admin email: ${admin.email}`);\n log.info(` Admin name: ${admin.firstName} ${admin.lastName}`);\n log.info(` Provider keys: ${providerNames.length > 0 ? `${providerNames.join(', ')} (${providerNames.length} configured)` : 'none'}`);\n\n log.info(` Public domain: ${env.publicDomain}`);\n if (runtime === WildoDeploymentRuntime.KUBERNETES) {\n log.info(` K8s namespace: ${env.kubernetes?.namespace}`);\n }\n\n const mongoSuffix = isLocalDb ? ', mongodb' : '';\n if (isFrameworkDeveloper) {\n log.info(`\\n Infra services: valkey, rabbitmq, minio${mongoSuffix}`);\n log.info(` Platform services: run natively (hot-reload)`);\n } else {\n log.info(`\\n Infra services: valkey, rabbitmq, minio${mongoSuffix}`);\n log.info(` Platform services: apps-manager, crontabs-batches-manager, module-registry (Docker containers)`);\n log.info(` Docker image: ${platformImageRef} (pulled from Docker Hub)`);\n }\n log.info('');\n}\n"]}
1
+ {"version":3,"file":"environment-setup.service.js","sourceRoot":"","sources":["../../../../src/services/environment/environment-setup.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAC;AACrG,OAAO,EAAoC,WAAW,EAAE,MAAM,qDAAqD,CAAC;AACpH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AACrF,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,GACnC,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAAE,aAAa,EAAE,MAAM,+DAA+D,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,oCAAoC,EAAE,MAAM,8DAA8D,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAChI,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kEAAkE,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE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,IAAI,CAAC,sGAAsG,CAAC,CAAC;QACjH,GAAG,CAAC,IAAI,CAAC,2BAA2B,gBAAgB,2BAA2B,CAAC,CAAC;IACnF,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACf,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { confirm } from '@inquirer/prompts';\n\nimport type { EnvSetupInput, SetupResult } from '~wildo-cli/services/environment/environment.schemas';\nimport type { ProviderKeysInput } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { EnvironmentLifecycle } from '~wildo-cli/services/environment/environment-lifecycle.service';\nimport { PlatformEnvironmentConfiguration, SetupStatus } from '~wildo-cli/services/environment/environment.schemas';\nimport {\n BackingServiceKind,\n BackingServiceSource,\n DatabaseEngine,\n K8S_LOCAL_DEFAULTS,\n KIND_CLUSTER_DEFAULTS,\n PUBLIC_DOMAIN_DEFAULTS,\n WildoDeploymentRuntime,\n WildoLocationType,\n} from '@wildo-ai/platform-config-lib';\nimport { ContextManager } from '~wildo-cli/services/context/context-manager.service';\nimport {\n applyProviderKeyDefaults,\n DEFAULT_PROVIDER_KEY_DEFAULTS_MODE,\n resolveProviderKeyDefaultsAdoption,\n} from '~wildo-cli/services/credentials/local-defaults.service';\nimport type { Logger } from '~wildo-cli/kernel/types';\n\nimport type { PathsConfig, RuntimeChoice } from '~wildo-cli/modules/domain/environment/module.types';\nimport type { DatabaseInitializationInput } from '~wildo-cli/services/data-services/data-services.schemas';\nimport { runtimeModule } from '~wildo-cli/modules/domain/environment/runtime-selector.module';\nimport { runtimeSemanticsModule } from '~wildo-cli/modules/domain/environment/runtime-semantics.module';\nimport { platformPathsModule } from '~wildo-cli/modules/domain/environment/paths-config.module';\nimport { platformDatabaseInitializationModule } from '~wildo-cli/modules/domain/environment/database-config.module';\nimport { platformAdminUserModule, resolveAdminUserFromEnvSeeds } from '~wildo-cli/modules/domain/credentials/admin-user.module';\nimport { resolveApproverIdentity } from '~wildo-cli/modules/domain/credentials/approver-user.module';\nimport { establishCreationEssentials } from '~wildo-cli/modules/domain/credentials/creation-essentials.module';\nimport { buildCredentials, readSetupSecrets, runSecretsWrite } from '~wildo-cli/services/credentials/secrets-writer.service';\nimport { getProviderSelectionCatalog } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { runInfraWrite } from '~wildo-cli/services/deployment/infra-writer.service';\nimport { runK8sBootstrap } from '~wildo-cli/services/deployment/k8s/k8s-bootstrap.service';\nimport { resolvePlatformImageRef } from '~wildo-cli/services/environment/platform-runtime.schemas';\nimport { readVersion } from '~wildo-cli/kernel/bootstrap';\nimport { EnvironmentPaths } from '~wildo-cli/services/environment/environment-paths.service';\nimport { loadAuthoredInfraEnvConfig } from '~wildo-cli/services/environment/authored-infra-config.utils';\n\n\n// NOTE: This service currently mixes interactive prompts (module calls) with\n// business logic (file writes). The interactive input collection should be\n// extracted to a command-layer pattern (using BaseCommand.prompt()), leaving\n// only non-interactive execution here.\n\n/**\n * Core environment setup flow — env-agnostic. Drives `wildo setup`.\n *\n * Two modes, ONE write path (Phase 2 below is identical for both — only how the answers are\n * OBTAINED differs, which is the point: a headless bootstrap must not be a second, drifting\n * implementation of setup):\n *\n * - **Interactive** (default) — the operator answers each module's prompts.\n * - **Non-interactive** (`options.nonInteractive`, i.e. `wildo setup --non-interactive`) — every\n * answer is DERIVED, never asked:\n * - runtime / runtimeEnvironment / paths / database ← the registered environment, which\n * `ExistingAppBootstrapService.ensureLocalEnvironment` projects from the authored\n * `wildo.infra.<env>.config.ts` at kernel bootstrap (`initializeEnvironment` returns that\n * existing registration untouched). The authored descriptor is the declaration of record —\n * a prompt could only contradict it.\n * - admin identity ← the `WILDO_INIT_ADMIN_*` env seeds, fail-closed when absent.\n * - provider API keys ← none (all optional).\n * - every credential (Mongo/Valkey/RabbitMQ/storage/platform secrets, the appsManager EC\n * keypair, and the admin password when unseeded) ← GENERATED by {@link buildCredentials}.\n * This is what makes a cold, unattended VM bootstrappable: `secrets.json` has no other minter,\n * and without it `local up` cannot write `.env.wildo-platform`. Non-interactive is IDEMPOTENT —\n * an already-COMPLETED setup is a no-op success unless `force` is set.\n */\nexport async function runEnvSetup(\n envName: string,\n locationType: WildoLocationType,\n options: EnvSetupInput,\n log: Logger,\n): Promise<SetupResult> {\n const cliContext = ContextManager.get();\n const preferences = cliContext.preferences;\n if (!preferences) {\n log.error(chalk.red('\\n No preferences found. Run the install script first.\\n'));\n return { success: false };\n }\n\n /*\n * The machine preference is a DEFAULT, not a verdict.\n *\n * It decides whether the platform services run natively from the checkout or as containers of the\n * published image, and one machine can legitimately host both kinds of environment. Resolved once\n * here so every later read sees the same answer; `preferences.isFrameworkDeveloper` is not read\n * directly below.\n */\n const isFrameworkDeveloper = options.frameworkDeveloper ?? preferences.isFrameworkDeveloper;\n\n const saasRoot = cliContext.resolvedHomes.app.declarationRoot;\n if (!saasRoot) {\n log.error(chalk.red('\\n No targeted app root detected.\\n'));\n return { success: false };\n }\n const frameworkPath = cliContext.resolvedHomes.framework.repositoryRoot;\n if (!frameworkPath) {\n log.error(chalk.red(\n '\\n No framework repository root detected. '\n + 'Re-run the CLI install script or set frameworkPath in your machine preferences.\\n',\n ));\n return { success: false };\n }\n const env = EnvironmentUtils.initializeEnvironment(envName, locationType, {\n secretsPath: EnvironmentPaths.resolveScopedSecretsBase(saasRoot),\n configPath: EnvironmentPaths.resolveScopedConfigBase(saasRoot),\n infraPath: EnvironmentPaths.resolveScopedInfraBase(saasRoot),\n });\n const previousSetupStatus = env.setupStatus;\n\n const isFirstTime = env.setupStatus !== SetupStatus.COMPLETED || options.force;\n\n if (!isFirstTime) {\n log.info(chalk.dim('\\n Existing setup detected.\\n'));\n printCurrentSummary(log, env);\n\n // Non-interactive is IDEMPOTENT: an already-COMPLETED setup is a no-op success, so a headless\n // lane (CI, a scripted re-provision) can call `wildo setup --non-interactive` unconditionally\n // on every run. Re-minting would rotate secrets.json — orphaning the Mongo/Valkey data those\n // credentials already protect and invalidating a running stack. `--force` re-authors configuration\n // while the credential writer preserves existing identities and generated material.\n if (options.nonInteractive) {\n log.info(chalk.dim(' Non-interactive: keeping the existing setup (pass --force to re-author).\\n'));\n return { success: true };\n }\n\n const reconfigure = await confirm({\n message: 'Reconfigure?',\n default: false,\n });\n\n if (!reconfigure) {\n log.info(chalk.dim('\\n Keeping current configuration.\\n'));\n return { success: true };\n }\n }\n\n EnvironmentUtils.setSetupStatus(SetupStatus.IN_PROGRESS, envName);\n\n try {\n // Step 1 — Paths\n log.info(chalk.cyan('\\n Step 1/6 — Storage Paths\\n'));\n const pathsCtx = {\n envName,\n saasRoot,\n isFirstTime,\n isFrameworkDeveloper: isFrameworkDeveloper,\n frameworkPath,\n currentSecrets: env.secretsPath,\n currentConfig: env.configPath,\n log,\n };\n // Non-interactive: the environment registration ALREADY carries resolved paths —\n // `ExistingAppBootstrapService.ensureLocalEnvironment` seeds them from the app root (or a\n // detected sibling wildo-secrets repo) at kernel bootstrap, and `initializeEnvironment`\n // returns that existing registration untouched. The prompt exists only to OFFER a sibling\n // repo / a custom location; neither is a headless decision, so we honor what is registered.\n /*\n * A supplied path ANSWERS step 1 and skips the prompt for that one value only. This is how an\n * environment joins a shared secrets location without an operator walking the wizard — the\n * prompt's own purpose, per its docstring, is to \"OFFER a sibling repo / a custom location\".\n */\n const pathOverrides = {\n ...(options.secretsPath === undefined ? {} : { secretsPath: options.secretsPath }),\n ...(options.configPath === undefined ? {} : { configPath: options.configPath }),\n ...(options.infraPath === undefined ? {} : { infraPath: options.infraPath }),\n };\n const answeredEveryPath = options.secretsPath !== undefined\n && options.configPath !== undefined\n && options.infraPath !== undefined;\n const pathsAnswers: PathsConfig = options.nonInteractive || answeredEveryPath\n ? {\n secretsPath: env.secretsPath,\n configPath: env.configPath,\n infraPath: env.infraPath,\n ...pathOverrides,\n }\n : { ...(await platformPathsModule.prompt(pathsCtx)), ...pathOverrides };\n await platformPathsModule.apply?.(pathsAnswers, pathsCtx);\n env.secretsPath = pathsAnswers.secretsPath;\n env.configPath = pathsAnswers.configPath;\n env.infraPath = pathsAnswers.infraPath;\n\n // Step 2 — Local platform question\n log.info('');\n // Non-interactive callers are bootstrapping a local platform BY DEFINITION (that is the only\n // thing this flow mints secrets for) — asking would be theatre, so it is an implicit yes.\n const wantsLocalPlatform = options.nonInteractive || await confirm({\n message: `Set up a local Wildo development platform?\n\n This will run infrastructure services (MongoDB, Valkey, RabbitMQ, etc.)\n locally using Docker, and bootstrap the Wildo platform for development.\n\n Set up local platform?`,\n default: true,\n });\n\n if (!wantsLocalPlatform) {\n log.info(chalk.dim('\\n Skipping local platform setup. CLI tools are still available.\\n'));\n EnvironmentUtils.setSetupStatus(SetupStatus.COMPLETED, envName);\n return { success: true };\n }\n\n // Step 3 — Runtime\n log.info(chalk.cyan('\\n Step 2/6 — Infrastructure Runtime\\n'));\n // Non-interactive: the AUTHORED `wildo.infra.<env>.config.ts` already DECLARES the runtime\n // (projected onto the registration by `ensureLocalEnvironment`). Re-asking would let an\n // operator's answer contradict the committed declaration — the authored file is the truth.\n const requestedRuntime = options.runtime === undefined\n ? undefined\n : Object.values(WildoDeploymentRuntime).find((candidate) => candidate === options.runtime);\n if (options.runtime !== undefined && requestedRuntime === undefined) {\n log.error(chalk.red(`\\n Invalid --runtime \"${options.runtime}\". Valid: ${Object.values(WildoDeploymentRuntime).join(', ')}\\n`));\n return { success: false };\n }\n const runtimeAnswers: RuntimeChoice = requestedRuntime !== undefined\n ? { runtime: requestedRuntime }\n : options.nonInteractive\n ? { runtime: env.runtime }\n : await runtimeModule.prompt({\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n env.runtime = runtimeAnswers.runtime;\n // Seed top-level `publicDomain` based on the runtime the operator\n // just chose. Required by the schema; for local interactive setup\n // the canonical write-time defaults from `PUBLIC_DOMAIN_DEFAULTS`\n // give the operator a working starting point that they can edit\n // afterwards in `wildo.infra.local.config.ts`.\n env.publicDomain = runtimeAnswers.runtime === WildoDeploymentRuntime.KUBERNETES\n ? PUBLIC_DOMAIN_DEFAULTS.LOCAL_K8S\n : PUBLIC_DOMAIN_DEFAULTS.LOCAL_COMPOSE;\n if (runtimeAnswers.runtime === WildoDeploymentRuntime.KUBERNETES) {\n env.kubernetes = {\n namespace: K8S_LOCAL_DEFAULTS.NAMESPACE,\n imageRegistry: `localhost:${KIND_CLUSTER_DEFAULTS.REGISTRY_PORT}`,\n };\n }\n\n // Step 4 — Runtime semantics\n log.info(chalk.cyan('\\n Step 3/6 — Application Runtime Semantics\\n'));\n const runtimeSemanticsAnswers = options.nonInteractive\n ? { runtimeEnvironment: env.runtimeEnvironment }\n : await runtimeSemanticsModule.prompt({ locationType });\n env.runtimeEnvironment = runtimeSemanticsAnswers.runtimeEnvironment;\n\n // Step 5 — Database\n log.info(chalk.cyan('\\n Step 4/6 — Database\\n'));\n // Non-interactive: `ensureLocalEnvironment` already resolved the AUTHORITATIVE database choice\n // from the authored infra descriptor's `backingServices` (falling back to self-hosted Mongo), so\n // the registration is the answer. The prompt's other branch (an external Atlas instance + its API\n // keys) is inherently interactive material and is NOT a headless-bootstrap scenario — a lane that\n // needs it must author it in `wildo.infra.<env>.config.ts` instead of answering a prompt.\n /*\n * `--database` answers the ENGINE and nothing else. The prompt's other branch — an external Atlas\n * instance and its API keys — is inherently interactive material, so a flag that claimed to answer\n * the whole step would be lying about the half it cannot carry.\n */\n const requestedEngine = options.database === undefined\n ? undefined\n : Object.values(DatabaseEngine).find((candidate) => candidate === options.database);\n if (options.database !== undefined && requestedEngine === undefined) {\n log.error(chalk.red(`\\n Invalid --database \"${options.database}\". Valid: ${Object.values(DatabaseEngine).join(', ')}\\n`));\n return { success: false };\n }\n const dbAnswers: DatabaseInitializationInput = requestedEngine !== undefined\n ? { database: { ...env.database, engine: requestedEngine } }\n : options.nonInteractive\n ? { database: env.database }\n : await platformDatabaseInitializationModule.prompt({\n envName,\n log,\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n await platformDatabaseInitializationModule.apply?.(dbAnswers, {\n envName,\n log,\n isFrameworkDeveloper: isFrameworkDeveloper,\n });\n env.database = dbAnswers.database;\n\n // Step 6 — Admin\n log.info(chalk.cyan('\\n Step 5/6 — Platform Administrator\\n'));\n // Non-interactive: identity from the `WILDO_INIT_ADMIN_*` env seeds, FAIL-CLOSED when absent —\n // the one thing a headless caller genuinely must state (see `resolveAdminUserFromEnvSeeds`).\n // Reconfiguration may add an approver or provider key, but is never credential rotation.\n // Read after path selection so this is the store the writer will actually update.\n // A hosted application's file holds only its own sections, so it is read as such; the authored descriptor decides.\n const authoredForEnv = await loadAuthoredInfraEnvConfig(envName, saasRoot);\n const existingSecrets = readSetupSecrets(EnvironmentPaths.resolveSecretsDir(envName), {\n hosted: authoredForEnv?.config.infrastructureHost !== undefined,\n });\n const adminAnswers = existingSecrets?.admin ?? (options.nonInteractive\n ? resolveAdminUserFromEnvSeeds(log)\n : await platformAdminUserModule.prompt({ log }));\n const approverAnswers = existingSecrets?.approver ?? resolveApproverIdentity({\n admin: adminAnswers,\n isLocalEnvironment: locationType === WildoLocationType.LOCAL,\n log,\n }).approver;\n\n // Step 7 — What development needs\n log.info(chalk.cyan('\\n Step 6/6 — Coding agent and LLM\\n'));\n /*\n * ONLY what development cannot start without (#1637, decided by Paul 2026-09-25): the coding\n * agent's login and the companion's LLM key. This step used to offer every provider in the\n * catalogue, whatever the application enabled; every other secret is now asked when something\n * first needs it — `wildo secrets set <NAME>`, or the workbench's secrets section.\n *\n * Non-interactive: nothing is typed; a missing login or key is REPORTED with the command that\n * fixes it, never refused — a headless lane supplies keys through its own secret store.\n */\n /*\n * ADOPT this machine's captured provider keys before asking for any.\n *\n * The headless branch used to answer `{}`, so an unattended setup produced an environment with NO\n * third-party credentials at all — correct when nothing had ever been captured, and needless\n * retyping once something had. Adoption fills it from `~/.wildo/local-defaults.json`, and the\n * prompt still runs interactively for anything the file does not carry.\n *\n * Only the PROVIDER-KEY half is decided here (`--provider-key-defaults`): setup never adopts the\n * shared platform credentials, so the `--local-defaults` it used to take governed provider keys\n * under the other half's name. See \"Two halves, two decisions\" in local-defaults.service.ts.\n */\n const providerKeyMode = options.providerKeyDefaults === undefined || options.providerKeyDefaults === ''\n ? preferences.defaults?.providerKeyDefaults ?? DEFAULT_PROVIDER_KEY_DEFAULTS_MODE\n : options.providerKeyDefaults;\n const offeredProviderEnv = await resolveProviderKeyDefaultsAdoption({\n mode: providerKeyMode,\n canAsk: options.nonInteractive !== true && process.stdin.isTTY === true,\n confirm: (names) => confirm({ message: `Use the provider keys captured on this machine (${names.join(', ')})?`, default: true }),\n }) ?? {};\n /*\n * SEED, never replace: only keys this environment does not already hold. Merged below over the existing\n * `providerEnv`, an adopted key would otherwise silently undo a key rotated with `wildo secrets set` on\n * any re-run of setup — and ADOPT, the default, no longer asks first. Same rule as init's draft.\n */\n const seededNames = applyProviderKeyDefaults({ providerEnv: { ...(existingSecrets?.providerEnv ?? {}) } }, offeredProviderEnv);\n const adoptedProviderEnv: Record<string, string> = Object.fromEntries(seededNames.map((name) => [name, offeredProviderEnv[name]!]));\n\n const essentials = await establishCreationEssentials({\n log,\n interactive: options.nonInteractive !== true && process.stdin.isTTY === true,\n saasRoot,\n // Names only: the essentials ask whether the LLM key is set, never what it is.\n storedProviderEnvNames: new Set(Object.entries({ ...(existingSecrets?.providerEnv ?? {}), ...adoptedProviderEnv })\n .filter(([, value]) => value.trim().length > 0)\n .map(([name]) => name)),\n codingAgentPreference: preferences.defaults?.codingAgent,\n });\n const promptedProviderAnswers: ProviderKeysInput = Object.keys(essentials.providerEnv).length === 0\n ? {}\n : { providerEnv: essentials.providerEnv };\n /*\n * The PROMPT wins over the adopted value: somebody typing a key on this run means it, and a\n * machine default must never silently replace an explicit answer.\n */\n const mergedProviderEnv = { ...adoptedProviderEnv, ...(promptedProviderAnswers.providerEnv ?? {}) };\n const providerAnswers: ProviderKeysInput = {\n ...promptedProviderAnswers,\n // OMITTED when empty rather than written as `{}`: a headless run that adopted nothing must\n // produce exactly what it produced before this existed, key for key.\n ...(Object.keys(mergedProviderEnv).length === 0 ? {} : { providerEnv: mergedProviderEnv }),\n };\n\n // Step 7 — Confirmation summary\n /*\n * The platform image is not a setup input: every lane that runs a platform container runs the\n * published `docker.io/wildoai/wildo-platform:<framework version>`, and a framework developer runs the\n * platform natively (`resolvePlatformImageRef`). Until 2026-09-06 setup handed `latest` to the renderer\n * for both lanes, so every app-creator `wildo setup` re-rendered the compose file to a `:latest` nobody\n * had promised to publish; until #2988 it still handed `latest` to a framework developer's render, for a\n * platform container their compose file never contains.\n */\n const platformImageRef = resolvePlatformImageRef({ frameworkVersion: readVersion() });\n\n log.info('');\n printSetupSummary(log, env, platformImageRef, isFrameworkDeveloper, adminAnswers, providerAnswers);\n\n // Non-interactive: the summary above is printed for the CI log, but there is nobody to confirm —\n // the caller already committed by passing --non-interactive.\n const proceed = options.nonInteractive || await confirm({ message: 'Proceed?', default: true });\n if (!proceed) {\n EnvironmentUtils.setSetupStatus(previousSetupStatus, envName);\n log.warn(chalk.yellow('\\n Setup cancelled.\\n'));\n return { success: false };\n }\n\n // --- Phase 2: File generation ---\n log.info(chalk.cyan('\\n Phase 2 — Generating configuration files...\\n'));\n\n const credentials = buildCredentials(adminAnswers, dbAnswers, providerAnswers, approverAnswers, existingSecrets ?? undefined);\n\n // Seed `env.backingServices` / `serviceAuth` / `logging` from the authored\n // `wildo.infra.<env>.config.ts` BEFORE rendering compose. The wizard's\n // prompts only cover paths/runtime/database — they don't touch the\n // authored backing-services map. Without this seed, the compose template\n // is rendered against an `env` whose `backingServices` is `undefined`,\n // which silently DROPS opt-in services like `clamav` (gated on\n // `env.backingServices?.clamav?.source === SELF` in the docker-compose\n // generator). Loading the authored descriptor here keeps setup honoring\n // the operator's authored choices.\n if (authoredForEnv) {\n env.backingServices = authoredForEnv.config.backingServices;\n env.serviceAuth = authoredForEnv.config.serviceAuth;\n env.logging = authoredForEnv.config.logging;\n env.infrastructureHost = authoredForEnv.config.infrastructureHost;\n }\n // Persisted BEFORE the secrets write below: the single secrets writer decides from the registry whether this\n // environment is hosted, and a hosted file must receive only its application-owned sections.\n if (env.infrastructureHost !== undefined) {\n EnvironmentUtils.updateEnvironmentState(env);\n }\n\n await runSecretsWrite(env, credentials, dbAnswers, log, authoredForEnv?.config);\n await runInfraWrite(env, frameworkPath, isFrameworkDeveloper, credentials, log);\n\n EnvironmentUtils.updateEnvironmentState(env);\n EnvironmentUtils.setSetupStatus(SetupStatus.COMPLETED, envName);\n log.success(chalk.green(' ✓ environments.json updated'));\n\n log.success(chalk.green('\\n Phase 2 complete — configuration files generated.\\n'));\n\n // --- Phase 3: K8s deployment (if applicable) ---\n // A hosted environment's cluster is its host's: bootstrapping it from here would delete and recreate it.\n if (env.runtime === WildoDeploymentRuntime.KUBERNETES && env.infrastructureHost === undefined) {\n const k8sResult = await runK8sBootstrap(\n env,\n frameworkPath,\n credentials,\n {\n reset: true,\n isFrameworkDeveloper: isFrameworkDeveloper,\n saasRoot,\n },\n log,\n );\n if (!k8sResult.success) {\n return { success: false };\n }\n }\n\n return { success: true, adminPassword: credentials.admin!.password };\n } catch (error) {\n EnvironmentUtils.setSetupStatus(SetupStatus.FAILED, envName);\n throw error;\n }\n}\n\n\nfunction printCurrentSummary(log: Logger, env: PlatformEnvironmentConfiguration): void {\n log.info(` Secrets path: ${env.secretsPath}`);\n log.info(` Config path: ${env.configPath}`);\n log.info(` Infra path: ${env.infraPath}`);\n log.info(` App semantics: ${env.runtimeEnvironment ?? 'not set'}`);\n log.info(` Database: ${env.database.engine} — ${env.database.source}`);\n log.info(` Setup status: ${env.setupStatus}`);\n}\n\nfunction printSetupSummary(\n log: Logger,\n env: PlatformEnvironmentConfiguration,\n platformImageRef: string,\n isFrameworkDeveloper: boolean,\n admin: { email: string; firstName: string; lastName: string },\n providers: ProviderKeysInput,\n): void {\n // A provider counts as configured when any of its declared secrets was\n // supplied; map the collected env-var names back to provider labels via the\n // same registry-derived catalog the setup selector uses.\n const configuredEnvVars = new Set(Object.keys(providers.providerEnv ?? {}));\n const providerNames = getProviderSelectionCatalog()\n .filter((entry) => entry.secrets.some((secret) => configuredEnvVars.has(secret.envVarName)))\n .map((entry) => entry.label);\n if (providers.githubOrgUrl) {\n providerNames.push('GitHub organization');\n }\n\n const runtime = env.runtime;\n const runtimeLabel = runtime === WildoDeploymentRuntime.DOCKER_COMPOSE ? 'Docker Compose' : 'Kubernetes';\n const isLocalDb = env.database.source === BackingServiceSource.SELF;\n const dbLabel = isLocalDb ? 'Local (Docker)' : 'Atlas (external)';\n\n log.info(chalk.bold(' Configuration summary:\\n'));\n log.info(` Secrets path: ${env.secretsPath}`);\n log.info(` Config path: ${env.configPath}`);\n log.info(` Infra path: ${env.infraPath}`);\n log.info(` Local platform: Yes`);\n log.info(` Runtime: ${runtimeLabel}`);\n log.info(` App semantics: ${env.runtimeEnvironment ?? 'not set'}`);\n log.info(` Database: ${env.database.engine} — ${dbLabel}`);\n log.info(` Admin email: ${admin.email}`);\n log.info(` Admin name: ${admin.firstName} ${admin.lastName}`);\n log.info(` Provider keys: ${providerNames.length > 0 ? `${providerNames.join(', ')} (${providerNames.length} configured)` : 'none'}`);\n\n log.info(` Public domain: ${env.publicDomain}`);\n if (runtime === WildoDeploymentRuntime.KUBERNETES) {\n log.info(` K8s namespace: ${env.kubernetes?.namespace}`);\n }\n\n // Derived from the same rule the lanes render from, so the summary cannot list a service the profile drops (#2303).\n // Called on `EnvironmentLifecycle` itself, not the `EnvironmentUtils` facade, which tests replace with a partial mock.\n const infraServices = [\n ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.REDIS) ? ['valkey'] : []),\n ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.RABBITMQ) ? ['rabbitmq'] : []),\n ...(EnvironmentLifecycle.selfHostsBackingService(env, BackingServiceKind.S3) ? ['minio'] : []),\n ...(isLocalDb ? ['mongodb'] : []),\n ].join(', ') || 'none';\n if (isFrameworkDeveloper) {\n log.info(`\\n Infra services: ${infraServices}`);\n log.info(` Platform services: run natively (hot-reload)`);\n } else {\n log.info(`\\n Infra services: ${infraServices}`);\n log.info(` Platform services: apps-manager, crontabs-batches-manager, module-registry (Docker containers)`);\n log.info(` Docker image: ${platformImageRef} (pulled from Docker Hub)`);\n }\n log.info('');\n}\n"]}
@@ -10,9 +10,9 @@
10
10
  * New code should import directly from the sub-service it needs.
11
11
  */
12
12
  import type { PlatformEnvironmentConfiguration, PlatformEnvironmentsState, PlatformEnvOperatingSystem } from '../../services/environment/environment.schemas';
13
- import type { BackingServiceKind, BackingServicesEnvConfig, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';
13
+ import type { BackingServiceKind, BackingServicesEnvConfig, EnvironmentServiceProfile, PlatformWildoServices, WildoDeploymentRuntime, WildoLocationType } from '@wildo-ai/platform-config-lib';
14
14
  import { SetupStatus } from '../../services/environment/environment.schemas';
15
- import type { PlatformDatabaseChoice, PlatformDataServices } from '../../services/data-services/data-services.schemas';
15
+ import type { PlatformDatabaseChoice } from '../../services/data-services/data-services.schemas';
16
16
  import type { ApplicationRuntimeIdentityJson, PlatformEnvConfigJson, PlatformEnvSecretsJson } from '../../services/credentials/credentials.schemas';
17
17
  export declare class EnvironmentUtils {
18
18
  static load(): PlatformEnvironmentsState;
@@ -57,13 +57,14 @@ export declare class EnvironmentUtils {
57
57
  static selfHostsBackingService(env: {
58
58
  name: string;
59
59
  backingServices?: BackingServicesEnvConfig;
60
+ serviceProfile?: EnvironmentServiceProfile;
60
61
  }, kind: BackingServiceKind): boolean;
61
62
  /** @see EnvironmentLifecycle.servesBackingServiceOffCluster — a USED kind served from outside the deployment (#3511). */
62
63
  static servesBackingServiceOffCluster(env: {
63
64
  name: string;
64
65
  backingServices?: BackingServicesEnvConfig;
66
+ serviceProfile?: EnvironmentServiceProfile;
65
67
  }, kind: BackingServiceKind): boolean;
66
- static getRequiredInfraServices(envName?: string): PlatformDataServices[];
67
68
  static getRequiredPlatformServices(): PlatformWildoServices[];
68
69
  static getRuntime(envName?: string): WildoDeploymentRuntime;
69
70
  static detectOS(): PlatformEnvOperatingSystem;
@@ -1 +1 @@
1
- {"version":3,"file":"environment.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,gCAAgC,EAChC,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACpK,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,qDAAqD,CAAC;AAM7D,qBAAa,gBAAgB;IAI3B,MAAM,CAAC,IAAI,IAAI,yBAAyB;IACxC,MAAM,CAAC,KAAK,IAAI,IAAI;IACpB,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC;IACjE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,gCAAgC,GAAG,SAAS;IACtE,MAAM,CAAC,UAAU,IAAI,gCAAgC,GAAG,SAAS;IACjE,MAAM,CAAC,cAAc,IAAI,MAAM;IAC/B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IACnC,MAAM,CAAC,SAAS,IAAI,MAAM,EAAE;IAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,MAAM,GAAG,cAAc,GAAG,WAAW,CAAC,CAAC,GAAG,IAAI;IAClI,MAAM,CAAC,M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,EAAE,MAAM,GAAG,MAAM;IAC9C,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAC7C,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IACjH,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAClD,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IACjD,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAChD,MAAM,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IACxD,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CACtE"}
1
+ {"version":3,"file":"environment.service.d.ts","sourceRoot":"","sources":["../../../../src/services/environment/environment.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,gCAAgC,EAChC,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC/L,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,qDAAqD,CAAC;AAM7D,qBAAa,gBAAgB;IAI3B,MAAM,CAAC,IAAI,IAAI,yBAAy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