@wildo-ai/wildo-cli 1.1.3 → 1.1.4

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 (141) hide show
  1. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts +2 -0
  2. package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts.map +1 -0
  3. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js +63 -0
  4. package/dist/src/commands/context/__tests__/assurance-basis.command.test.js.map +1 -0
  5. package/dist/src/commands/context/assurance-basis.command.d.ts +61 -0
  6. package/dist/src/commands/context/assurance-basis.command.d.ts.map +1 -0
  7. package/dist/src/commands/context/assurance-basis.command.js +166 -0
  8. package/dist/src/commands/context/assurance-basis.command.js.map +1 -0
  9. package/dist/src/commands/dev/charts-audit.command.d.ts +5 -3
  10. package/dist/src/commands/dev/charts-audit.command.d.ts.map +1 -1
  11. package/dist/src/commands/dev/charts-audit.command.js +35 -6
  12. package/dist/src/commands/dev/charts-audit.command.js.map +1 -1
  13. package/dist/src/commands/fwk/generate-providers.command.d.ts.map +1 -1
  14. package/dist/src/commands/fwk/generate-providers.command.js +18 -2
  15. package/dist/src/commands/fwk/generate-providers.command.js.map +1 -1
  16. package/dist/src/commands/generate/email-preview.command.d.ts +8 -0
  17. package/dist/src/commands/generate/email-preview.command.d.ts.map +1 -1
  18. package/dist/src/commands/generate/email-preview.command.js +57 -0
  19. package/dist/src/commands/generate/email-preview.command.js.map +1 -1
  20. package/dist/src/commands/init.command.d.ts.map +1 -1
  21. package/dist/src/commands/init.command.js +32 -0
  22. package/dist/src/commands/init.command.js.map +1 -1
  23. package/dist/src/commands/lock/check.command.d.ts.map +1 -1
  24. package/dist/src/commands/lock/check.command.js +3 -2
  25. package/dist/src/commands/lock/check.command.js.map +1 -1
  26. package/dist/src/commands/registry/login.command.d.ts.map +1 -1
  27. package/dist/src/commands/registry/login.command.js +2 -0
  28. package/dist/src/commands/registry/login.command.js.map +1 -1
  29. package/dist/src/commands/registry/publish.command.d.ts.map +1 -1
  30. package/dist/src/commands/registry/publish.command.js +2 -0
  31. package/dist/src/commands/registry/publish.command.js.map +1 -1
  32. package/dist/src/commands/registry/registry-transport.constants.d.ts +33 -0
  33. package/dist/src/commands/registry/registry-transport.constants.d.ts.map +1 -0
  34. package/dist/src/commands/registry/registry-transport.constants.js +33 -0
  35. package/dist/src/commands/registry/registry-transport.constants.js.map +1 -0
  36. package/dist/src/commands/registry/whoami.command.d.ts.map +1 -1
  37. package/dist/src/commands/registry/whoami.command.js +2 -0
  38. package/dist/src/commands/registry/whoami.command.js.map +1 -1
  39. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts +2 -0
  40. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts.map +1 -0
  41. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js +146 -0
  42. package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js.map +1 -0
  43. package/dist/src/modules/domain/credentials/approver-user.module.d.ts +85 -0
  44. package/dist/src/modules/domain/credentials/approver-user.module.d.ts.map +1 -0
  45. package/dist/src/modules/domain/credentials/approver-user.module.js +92 -0
  46. package/dist/src/modules/domain/credentials/approver-user.module.js.map +1 -0
  47. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts +2 -0
  48. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts.map +1 -0
  49. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js +111 -0
  50. package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js.map +1 -0
  51. package/dist/src/services/application/__tests__/provider-package-links.service.test.js +68 -0
  52. package/dist/src/services/application/__tests__/provider-package-links.service.test.js.map +1 -1
  53. package/dist/src/services/application/app-bootstrap.service.d.ts +9 -0
  54. package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
  55. package/dist/src/services/application/app-bootstrap.service.js +30 -1
  56. package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
  57. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts +6 -0
  58. package/dist/src/services/application/application-runtime-bootstrap.service.d.ts.map +1 -1
  59. package/dist/src/services/application/application-runtime-bootstrap.service.js +41 -0
  60. package/dist/src/services/application/application-runtime-bootstrap.service.js.map +1 -1
  61. package/dist/src/services/application/provider-package-links.service.d.ts +30 -0
  62. package/dist/src/services/application/provider-package-links.service.d.ts.map +1 -1
  63. package/dist/src/services/application/provider-package-links.service.js +35 -3
  64. package/dist/src/services/application/provider-package-links.service.js.map +1 -1
  65. package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
  66. package/dist/src/services/application/provider-runtime-sync.service.js +4 -3
  67. package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
  68. package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
  69. package/dist/src/services/application/saas-skeleton.service.js +22 -2
  70. package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
  71. package/dist/src/services/companion/workbench-cli.service.js +10 -1
  72. package/dist/src/services/companion/workbench-cli.service.js.map +1 -1
  73. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts +2 -0
  74. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts.map +1 -0
  75. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js +94 -0
  76. package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js.map +1 -0
  77. package/dist/src/services/credentials/ci-secrets-adapter.service.d.ts.map +1 -1
  78. package/dist/src/services/credentials/ci-secrets-adapter.service.js +16 -0
  79. package/dist/src/services/credentials/ci-secrets-adapter.service.js.map +1 -1
  80. package/dist/src/services/credentials/composed-provider-catalogue.d.ts +34 -0
  81. package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
  82. package/dist/src/services/credentials/composed-provider-catalogue.js +35 -0
  83. package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
  84. package/dist/src/services/credentials/credentials.schemas.d.ts +27 -0
  85. package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
  86. package/dist/src/services/credentials/credentials.schemas.js +50 -0
  87. package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
  88. package/dist/src/services/credentials/framework-managed-secrets.d.ts +1 -1
  89. package/dist/src/services/credentials/framework-managed-secrets.d.ts.map +1 -1
  90. package/dist/src/services/credentials/framework-managed-secrets.js +49 -8
  91. package/dist/src/services/credentials/framework-managed-secrets.js.map +1 -1
  92. package/dist/src/services/deployment/infra-writer.service.d.ts.map +1 -1
  93. package/dist/src/services/deployment/infra-writer.service.js +23 -4
  94. package/dist/src/services/deployment/infra-writer.service.js.map +1 -1
  95. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js +45 -2
  96. package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js.map +1 -1
  97. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts +23 -0
  98. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts.map +1 -1
  99. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js +49 -6
  100. package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js.map +1 -1
  101. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  102. package/dist/src/services/environment/env-vars-builder.service.js +19 -0
  103. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  104. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js +8 -0
  105. package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js.map +1 -1
  106. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js +17 -0
  107. package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js.map +1 -1
  108. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js +51 -0
  109. package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js.map +1 -1
  110. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts +41 -1
  111. package/dist/src/services/framework/framework-knowledge-audit.service.d.ts.map +1 -1
  112. package/dist/src/services/framework/framework-knowledge-audit.service.js +90 -0
  113. package/dist/src/services/framework/framework-knowledge-audit.service.js.map +1 -1
  114. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts +2 -0
  115. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts.map +1 -0
  116. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js +100 -0
  117. package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js.map +1 -0
  118. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js +55 -2
  119. package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js.map +1 -1
  120. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts +9 -0
  121. package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts.map +1 -1
  122. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js +139 -19
  123. package/dist/src/services/framework/provider-transposition/provider-package.emitter.js.map +1 -1
  124. package/dist/src/services/frontend/cloudflare-cdn.service.d.ts.map +1 -1
  125. package/dist/src/services/frontend/cloudflare-cdn.service.js +33 -2
  126. package/dist/src/services/frontend/cloudflare-cdn.service.js.map +1 -1
  127. package/dist/tsconfig.build.tsbuildinfo +1 -1
  128. package/dist/tsconfig.tsbuildinfo +1 -1
  129. package/package.json +17 -17
  130. package/scripts/app-dependency-alignment/propagated-engine-overrides.json +13 -0
  131. package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +64 -16
  132. package/templates/saas/engine-peer-closure.json +12 -0
  133. package/templates/saas/scenarios/add-provider/scenario.json +11 -11
  134. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/docusaurus.config.ts.hbs +34 -0
  135. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/pages/auth/exchange.tsx +24 -1
  136. package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/theme/Root.tsx +22 -2
  137. package/templates/saas/skeleton/backend-api/package.json.hbs +1 -1
  138. package/templates/saas/skeleton/backend-api/src/companion-exports.ts +13 -2
  139. package/wildo-framework.info.json +1 -1
  140. package/templates/saas/scenarios/add-backend-provider/scenario.json +0 -17
  141. package/templates/saas/skeleton/backend-api/src/provider-contributions.ts +0 -44
@@ -57,6 +57,7 @@
57
57
  * The engine tier is never registered and never removed: it is the floor.
58
58
  */
59
59
  import { type BackendProtocolBinding, type BackendProviderModule } from '@wildo-ai/external-connectors-private/backend';
60
+ import { type DiscoveredProviderCompanionContribution, type WildoSaasConfig } from '@wildo-ai/platform-config-lib';
60
61
  import type { ProviderCompanionContribution } from '@wildo-ai/saas-models';
61
62
  /**
62
63
  * The identity half a catalogue entry carries: package, tier, vendor, origin.
@@ -128,6 +129,39 @@ export interface ProviderSecretsCatalogueEntry {
128
129
  * the substitution this layer must not perform.
129
130
  */
130
131
  export declare function registerDiscoveredProviderContributions(contributions: readonly ProviderCompanionContribution[]): void;
132
+ /**
133
+ * Discover an application's provider contributions AND register them, as one step.
134
+ *
135
+ * ## Why the pairing, and why here (2026-09-09)
136
+ *
137
+ * `resolveValidatedSaasProviderContributions` already pairs the WALK with the VALIDATION, for the
138
+ * reason its own JSDoc gives: three correct call sites with nothing making a fourth correct is the
139
+ * shape `.claude/rules/invariant-call-site-enumeration.md` is about. This is the same defect one
140
+ * step further along — every CLI caller resolved contributions and none of them registered the
141
+ * result, so {@link getComposedProviderSecretsCatalogue} was ENGINE-TIER ONLY in every CLI process
142
+ * that had, moments earlier, read the full catalogue off disk.
143
+ *
144
+ * What that cost is not abstract. {@link filterProviderEnvToScope} attributes a `providerEnv` key
145
+ * by asking this catalogue which provider declares it, and drops what it cannot attribute. So an
146
+ * application that declares `asana` in `providers.scopes.backend`, and authors the
147
+ * `ASANA_CLIENT_ID` / `ASANA_CLIENT_SECRET` its generated secrets contract names, had both keys
148
+ * dropped from the backend runtime's env — with a warning saying they "belong to no provider the
149
+ * CLI can see", naming `asana` in the very list of providers the runtime was scoped to. Measured
150
+ * 2026-09-09 on Wonder Todos: the drop reached every one of the catalogue-tier providers, which is
151
+ * the entire OAuth2 connect lane, because a provider registration cannot reach the process that
152
+ * performs the authorization-code exchange.
153
+ *
154
+ * It read as an authoring mistake and was a wiring gap. The engine tier worked throughout, which is
155
+ * exactly why it survived: every provider the framework ships is registered by the floor, so the
156
+ * only population that could reveal this is the one nobody had authored a secret for yet.
157
+ *
158
+ * Registration is idempotent per ref and additive, so calling this more than once in a process is
159
+ * safe; the engine tier always wins a collision (see {@link registerDiscoveredProviderContributions}).
160
+ */
161
+ export declare function resolveAndRegisterSaasProviderContributions(input: {
162
+ saasRoot: string;
163
+ saasConfig: Pick<WildoSaasConfig, 'modules' | 'services' | 'libraries' | 'minions' | 'providers' | 'workers'>;
164
+ }): Promise<DiscoveredProviderCompanionContribution[]>;
131
165
  /**
132
166
  * Drop every registered contribution. The engine tier is untouched — it is not registered.
133
167
  *
@@ -1 +1 @@
1
- {"version":3,"file":"composed-provider-catalogue.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/composed-provider-catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AAE/F,+FAA+F;AAC/F,MAAM,WAAW,uBAAuB;IACtC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D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AM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAM7G,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;CAC7E"}
1
+ {"version":3,"file":"composed-provider-catalogue.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/composed-provider-catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,uCAAuC,EAC5C,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AAE/F,+FAA+F;AAC/F,MAAM,WAAW,uBAAuB;IACtC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAM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,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC;IAE/D,IAAI,IAAI,IAAI,MAAM,CAAgC;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IACzB,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAM7G,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;CAC7E"}
@@ -57,6 +57,7 @@
57
57
  * The engine tier is never registered and never removed: it is the floor.
58
58
  */
59
59
  import { EngineBackendProviderRegistry, } from '@wildo-ai/external-connectors-private/backend';
60
+ import { resolveValidatedSaasProviderContributions, } from '@wildo-ai/platform-config-lib';
60
61
  // ---------------------------------------------------------------------------
61
62
  // Composition state
62
63
  // ---------------------------------------------------------------------------
@@ -91,6 +92,40 @@ export function registerDiscoveredProviderContributions(contributions) {
91
92
  }
92
93
  catalogueGeneration += 1;
93
94
  }
95
+ /**
96
+ * Discover an application's provider contributions AND register them, as one step.
97
+ *
98
+ * ## Why the pairing, and why here (2026-09-09)
99
+ *
100
+ * `resolveValidatedSaasProviderContributions` already pairs the WALK with the VALIDATION, for the
101
+ * reason its own JSDoc gives: three correct call sites with nothing making a fourth correct is the
102
+ * shape `.claude/rules/invariant-call-site-enumeration.md` is about. This is the same defect one
103
+ * step further along — every CLI caller resolved contributions and none of them registered the
104
+ * result, so {@link getComposedProviderSecretsCatalogue} was ENGINE-TIER ONLY in every CLI process
105
+ * that had, moments earlier, read the full catalogue off disk.
106
+ *
107
+ * What that cost is not abstract. {@link filterProviderEnvToScope} attributes a `providerEnv` key
108
+ * by asking this catalogue which provider declares it, and drops what it cannot attribute. So an
109
+ * application that declares `asana` in `providers.scopes.backend`, and authors the
110
+ * `ASANA_CLIENT_ID` / `ASANA_CLIENT_SECRET` its generated secrets contract names, had both keys
111
+ * dropped from the backend runtime's env — with a warning saying they "belong to no provider the
112
+ * CLI can see", naming `asana` in the very list of providers the runtime was scoped to. Measured
113
+ * 2026-09-09 on Wonder Todos: the drop reached every one of the catalogue-tier providers, which is
114
+ * the entire OAuth2 connect lane, because a provider registration cannot reach the process that
115
+ * performs the authorization-code exchange.
116
+ *
117
+ * It read as an authoring mistake and was a wiring gap. The engine tier worked throughout, which is
118
+ * exactly why it survived: every provider the framework ships is registered by the floor, so the
119
+ * only population that could reveal this is the one nobody had authored a secret for yet.
120
+ *
121
+ * Registration is idempotent per ref and additive, so calling this more than once in a process is
122
+ * safe; the engine tier always wins a collision (see {@link registerDiscoveredProviderContributions}).
123
+ */
124
+ export async function resolveAndRegisterSaasProviderContributions(input) {
125
+ const contributions = await resolveValidatedSaasProviderContributions(input);
126
+ registerDiscoveredProviderContributions(contributions);
127
+ return contributions;
128
+ }
94
129
  /**
95
130
  * Drop every registered contribution. The engine tier is untouched — it is not registered.
96
131
  *
@@ -1 +1 @@
1
- {"version":3,"file":"composed-provider-catalogue.js","sourceRoot":"","sources":["../../../../src/services/credentials/composed-provider-catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EACL,6BAA6B,GAG9B,MAAM,+CAA+C,CAAC;AA+DvD,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8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AC;YACnB,gBAAgB,GAAG,mBAAmB,CAAC;QACzC,CAAC;QACD,OAAO,MAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;IAAG,CAAC;IAEnE,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,GAAG,CAAC,GAAW,IAAa,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,QAA2E,EAAE,OAAiB;QACpG,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,yFAAyF;IACzF,+FAA+F;IAC/F,4EAA4E;IAC5E,IAAI,KAA8C,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,KAAgD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvF,OAAO,KAAiD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC1F,CAAC,MAAM,CAAC,QAAQ,CAAC,KAA8D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;CAC3H","sourcesContent":["/**\n * The COMPOSED provider catalogue — the one place the CLI's secrets layer asks\n * \"which providers exist, and which environment variables carry their credentials?\".\n *\n * ## Why this module exists (issue #329, audit finding PL-3)\n *\n * Every secrets and environment path used to answer that question from\n * `EngineBackendProviderRegistry`, a map that by construction can only ever hold the engine's\n * own modules. While every provider was engine-shipped that was invisible. It stopped being\n * true with `providers/slack` (#341), the first provider shipped as its own package, and it\n * becomes routine once the loading slice (#330) lets an application compose one.\n *\n * The consequence was not a missing feature but a SILENT SECURITY REGRESSION, in two places at\n * once:\n *\n * - a package-shipped provider's key is attributable to no provider, so it is not classified\n * sensitive — it can land in a Kubernetes `ConfigMap` instead of a `Secret`;\n * - the per-runtime confinement filter allow-listed by the same registry and KEPT any key it\n * could not attribute, \"because it is configuration rather than a provider secret\" — so the\n * key was copied into every worker and minion environment, which is exactly what LLM-driven\n * minion code can read.\n *\n * Neither logged, warned or refused. That is why the plan orders this slice BEFORE the loader.\n *\n * ## The two sources, one shape\n *\n * | tier | source | carries |\n * |---|---|---|\n * | engine | `EngineBackendProviderRegistry.modules` | metadata, capabilities, `secretsContract`, and the full `protocols[]` runtime contracts |\n * | package / application | {@link ProviderCompanionContribution} | the same, MINUS the runtime contracts (a contribution is values-free DATA, so the CLI can read a provider whose backend module it cannot import) |\n *\n * **For CLASSIFICATION and CONFINEMENT, a contribution-sourced entry loses nothing, and that is\n * measured rather than assumed.** Across all 22 engine providers, every `secretRef` named by any\n * protocol's `runtimeContract` is already an `envVarName` declared in that same provider's\n * `secretsContract` — zero exceptions, 25 occurrences. So `secretsContractShape` is a COMPLETE\n * attribution source for those two questions: a package provider that ships only a `./companion`\n * export is classified and confined exactly as well as an engine one.\n *\n * **The converse does NOT hold, and one consumer depends on it.** The contract half is a strict\n * SUPERSET of what the bindings name — 13 engine contract keys are named by no binding at all\n * (every `IMMUDB_*`, `POSTHOG_PROJECT_API_KEY`, `BETTERSTACK_SOURCE_TOKEN`,\n * `ODOO_BASE_URL`/`_DB`/`_LOGIN`) — so anything that enumerates BINDINGS rather than the contract\n * sees less than the whole provider. `wildo config sync` builds the CI\n * `WILDO_SECRET_PROVIDER_ENV_*` block that way, so a contribution-sourced provider (zero bindings)\n * contributes zero CI secret keys. That gap is pre-existing for those 13 engine keys and is\n * tracked as issue #361; do not read the paragraph above as saying `protocolBindings: []` is\n * harmless everywhere. It is harmless for the two questions this module answers.\n *\n * ## Why registration is a door rather than a constructor argument\n *\n * Discovery of an application's provider packages necessarily runs AFTER this module is\n * imported — `credentials.schemas.ts` evaluates its sensitive-key set at module load, on the\n * first import of the CLI's credential layer. So composition cannot be an argument threaded\n * from a caller; it is a registration the discovery walk performs once it knows the\n * application, and every derived view recomputes from it. See {@link catalogueGeneration}.\n *\n * The engine tier is never registered and never removed: it is the floor.\n */\n\nimport {\n EngineBackendProviderRegistry,\n type BackendProtocolBinding,\n type BackendProviderModule,\n} from '@wildo-ai/external-connectors-private/backend';\nimport type { ProviderCompanionContribution } from '@wildo-ai/saas-models';\n\n/**\n * The identity half a catalogue entry carries: package, tier, vendor, origin.\n *\n * Taken from the CONTRIBUTION's inferred type rather than from `ProviderIdentity`, because the\n * two disagree on `origin`: the hand-written `ProviderIdentity` narrows it to the three-member\n * union (`catalogue` present iff `GENERATED`), while the contribution schema types the field\n * straight off `z.infer`, where it is the flat object the union's members all satisfy. This is\n * therefore the widest common shape — an engine module's `ProviderMetadata` assigns to it, and a\n * contribution's does too, with no cast on either side. Narrowing the wire record is territory A's\n * decision, not this slice's.\n */\nexport type ProviderCatalogueIdentity = NonNullable<ProviderCompanionContribution['identity']>;\n\n/** One secret a provider declares, values-free. Mirrors `ProviderSecretContractShapeEntry`. */\nexport interface ProviderCatalogueSecret {\n /** The provider-owned stable slug (the `secretsContract` key). */\n slug: string;\n /** The environment variable that carries the value. */\n envVarName: string;\n /** The provider refuses to boot without it once enabled. */\n required: boolean;\n description?: string;\n}\n\n/**\n * One provider as the CLI's secrets layer sees it, whatever tier shipped it.\n *\n * Deliberately NOT `BackendProviderModule`: that type is only constructible by importing a\n * provider's backend module, which is precisely what a package-shipped provider makes\n * impossible for tooling. This is the intersection the secrets layer actually needs.\n */\nexport interface ProviderSecretsCatalogueEntry {\n providerRef: string;\n /** Operator-facing label. Falls back to the ref — a contribution carries no display name. */\n label: string;\n /** Package / tier / vendor / origin, when the source declares it. */\n identity?: ProviderCatalogueIdentity;\n providerCapabilities: readonly string[];\n /**\n * Sorted by slug. Uniqueness on both slug and env-var name is enforced by\n * `ProviderCompanionContributionSchema` at the WIRE boundary — which this door is not — so the\n * ordering is re-established here rather than assumed, and uniqueness is a caller obligation\n * that {@link registerDiscoveredProviderContributions} deliberately does not re-parse.\n */\n secrets: readonly ProviderCatalogueSecret[];\n /**\n * The provider's protocol bindings — EMPTY for a contribution-sourced entry, because a\n * runtime contract is code and a contribution is data. Consumers that need bindings must\n * tolerate the empty case rather than treating it as an unknown provider.\n */\n protocolBindings: readonly BackendProtocolBinding[];\n /**\n * The OTLP auth hint, when the source is a loadable module. A contribution does not carry it,\n * so a package-shipped telemetry provider currently yields no header — the same outcome as an\n * engine provider that declares none, and a gap owed to whichever slice makes the hint\n * companion-safe.\n */\n otlpAuth?: BackendProviderModule['otlpAuth'];\n}\n\n// ---------------------------------------------------------------------------\n// Composition state\n// ---------------------------------------------------------------------------\n\n/** Registered non-engine contributions, keyed by ref. */\nconst discoveredContributions = new Map<string, ProviderCompanionContribution>();\n\n/**\n * Bumped by every registration and reset. Derived views memoise against it, so a view computed\n * before discovery cannot survive discovery — the stale-singleton failure this slice removes.\n */\nlet catalogueGeneration = 0;\n\n/**\n * Register provider contributions discovered outside the engine registry.\n *\n * This is the door the package-provider discovery walk (#330) calls once it has resolved an\n * application's declared provider packages and read their `./companion` exports. Idempotent by\n * ref: registering the same ref twice replaces the entry rather than duplicating it, so a\n * re-run of discovery is safe.\n *\n * A ref that the ENGINE already ships is ignored, deliberately and loudly: the engine tier is\n * the floor, and a package silently shadowing an engine provider's secret contract is exactly\n * the substitution this layer must not perform.\n */\nexport function registerDiscoveredProviderContributions(\n contributions: readonly ProviderCompanionContribution[],\n): void {\n for (const contribution of contributions) {\n if (EngineBackendProviderRegistry.getProviderByRef(contribution.ref as never)) {\n // eslint-disable-next-line no-console\n console.warn(\n `[provider-catalogue] Contribution for '${contribution.ref}' is ignored: an engine-shipped `\n + 'provider already owns that ref, and the engine tier is authoritative for its secrets contract.',\n );\n continue;\n }\n discoveredContributions.set(contribution.ref, contribution);\n }\n catalogueGeneration += 1;\n}\n\n/**\n * Drop every registered contribution. The engine tier is untouched — it is not registered.\n *\n * Used when discovery re-runs for a different application, and by tests. A CLI process that\n * handles one application never needs it.\n */\nexport function resetDiscoveredProviderContributions(): void {\n discoveredContributions.clear();\n catalogueGeneration += 1;\n}\n\n// ---------------------------------------------------------------------------\n// The composed view\n// ---------------------------------------------------------------------------\n\nfunction entryFromEngineModule(module: BackendProviderModule): ProviderSecretsCatalogueEntry {\n const secretsContract = module.secretsContract as Record<\n string,\n { envVarName: string; required?: boolean; description?: string }\n >;\n return {\n providerRef: module.metadata.ref,\n label: module.metadata.displayName ?? module.metadata.ref,\n identity: {\n packageName: module.metadata.packageName,\n tier: module.metadata.tier,\n vendor: module.metadata.vendor,\n origin: module.metadata.origin,\n },\n providerCapabilities: [...module.providerCapabilities],\n secrets: Object.entries(secretsContract ?? {})\n .map(([slug, entry]) => ({\n slug,\n envVarName: entry.envVarName,\n required: Boolean(entry.required),\n description: entry.description,\n }))\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n protocolBindings: module.protocols,\n otlpAuth: module.otlpAuth,\n };\n}\n\nfunction entryFromContribution(\n contribution: ProviderCompanionContribution,\n): ProviderSecretsCatalogueEntry {\n return {\n providerRef: contribution.ref,\n // A contribution carries `identity` but no display name — the metadata field is\n // frontend-facing copy and stays out of the values-free wire record. The ref is the honest\n // fallback, and it is what an unnamed engine provider gets too.\n label: contribution.ref,\n identity: contribution.identity,\n providerCapabilities: contribution.providerCapabilities ?? [],\n secrets: (contribution.secretsContractShape ?? [])\n .map((entry) => ({\n slug: entry.slug,\n envVarName: entry.envVarName,\n required: entry.required,\n description: entry.description,\n }))\n // Re-sorted rather than trusted: the schema orders these, but this door accepts a\n // contribution object, not a parsed wire record, so the ordering is only guaranteed where it\n // is performed. The engine branch sorts for the same reason.\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n protocolBindings: [],\n };\n}\n\nlet cachedCatalogue: ReadonlyMap<string, ProviderSecretsCatalogueEntry> | undefined;\nlet cachedCatalogueGeneration = -1;\n\n/**\n * Every provider the CLI can currently see: the engine tier, plus whatever discovery has\n * registered. Insertion order is engine-first, then registration order, so callers that sort\n * (the setup catalogue) and callers that do not (classification) both stay deterministic.\n */\nexport function getComposedProviderSecretsCatalogue(): ReadonlyMap<string, ProviderSecretsCatalogueEntry> {\n if (cachedCatalogue && cachedCatalogueGeneration === catalogueGeneration) return cachedCatalogue;\n\n const catalogue = new Map<string, ProviderSecretsCatalogueEntry>();\n for (const module of EngineBackendProviderRegistry.modules.values()) {\n catalogue.set(module.metadata.ref, entryFromEngineModule(module));\n }\n for (const contribution of discoveredContributions.values()) {\n if (catalogue.has(contribution.ref)) continue;\n catalogue.set(contribution.ref, entryFromContribution(contribution));\n }\n\n cachedCatalogue = catalogue;\n cachedCatalogueGeneration = catalogueGeneration;\n return catalogue;\n}\n\n/** One provider by ref, or `undefined` when nothing in the composed catalogue claims it. */\nexport function getComposedProviderEntry(providerRef: string): ProviderSecretsCatalogueEntry | undefined {\n return getComposedProviderSecretsCatalogue().get(providerRef);\n}\n\n/**\n * Memoise a value derived from the composed catalogue, invalidated by registration.\n *\n * The point is not speed. It is that a derived view CANNOT be a module-load snapshot: the\n * previous `PROVIDER_SENSITIVE_ENV_KEYS` was computed the moment its module was imported, which\n * is always before discovery could have run, so a composed catalogue would have been silently\n * ignored by the very classification it exists to feed.\n */\nexport function memoiseOverCatalogue<T>(compute: () => T): () => T {\n let cached: T | undefined;\n let cachedGeneration = -1;\n return () => {\n if (cachedGeneration !== catalogueGeneration) {\n cached = compute();\n cachedGeneration = catalogueGeneration;\n }\n return cached as T;\n };\n}\n\n/**\n * A `ReadonlySet<string>` whose contents are recomputed from the composed catalogue on every\n * read, rather than frozen when the module was imported.\n *\n * Exists so `PROVIDER_SENSITIVE_ENV_KEYS` and `SENSITIVE_ENV_KEYS` can keep their exported\n * NAMES and their `.has()` shape while becoming composition-aware — their consumers\n * (`k8s-secrets-generator.service.ts`, `sync.command.ts`) live outside this slice's territory\n * and must not need an edit to stay correct.\n */\nexport class LiveEnvKeySet implements ReadonlySet<string> {\n constructor(private readonly resolve: () => ReadonlySet<string>) {}\n\n get size(): number { return this.resolve().size; }\n has(key: string): boolean { return this.resolve().has(key); }\n forEach(callback: (value: string, value2: string, set: ReadonlySet<string>) => void, thisArg?: unknown): void {\n for (const key of this.resolve()) callback.call(thisArg, key, key, this);\n }\n // Return types are read OFF `ReadonlySet` rather than spelled as `IterableIterator`: the\n // standard library renamed these to `SetIterator` (which also carries `[Symbol.dispose]`) in a\n // recent lib, so a spelled-out type breaks on one lib version or the other.\n keys(): ReturnType<ReadonlySet<string>['keys']> { return this.resolve().keys(); }\n values(): ReturnType<ReadonlySet<string>['values']> { return this.resolve().values(); }\n entries(): ReturnType<ReadonlySet<string>['entries']> { return this.resolve().entries(); }\n [Symbol.iterator](): ReturnType<ReadonlySet<string>[typeof Symbol.iterator]> { return this.resolve()[Symbol.iterator](); }\n}\n"]}
1
+ {"version":3,"file":"composed-provider-catalogue.js","sourceRoot":"","sources":["../../../../src/services/credentials/composed-provider-catalogue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EACL,6BAA6B,GAG9B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,yCAAyC,GAG1C,MAAM,+BAA+B,CAAC;AA+DvC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,yDAAyD;AACzD,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAyC,CAAC;AAEjF;;;GAGG;AACH,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uCAAuC,CACrD,aAAuD;IAEvD,KAAK,M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C7C,MAAM,GAAG,OAAO,EAAE,CAAC;YACnB,gBAAgB,GAAG,mBAAmB,CAAC;QACzC,CAAC;QACD,OAAO,MAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;IAAG,CAAC;IAEnE,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,GAAG,CAAC,GAAW,IAAa,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,QAA2E,EAAE,OAAiB;QACpG,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,yFAAyF;IACzF,+FAA+F;IAC/F,4EAA4E;IAC5E,IAAI,KAA8C,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,KAAgD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvF,OAAO,KAAiD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC1F,CAAC,MAAM,CAAC,QAAQ,CAAC,KAA8D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;CAC3H","sourcesContent":["/**\n * The COMPOSED provider catalogue — the one place the CLI's secrets layer asks\n * \"which providers exist, and which environment variables carry their credentials?\".\n *\n * ## Why this module exists (issue #329, audit finding PL-3)\n *\n * Every secrets and environment path used to answer that question from\n * `EngineBackendProviderRegistry`, a map that by construction can only ever hold the engine's\n * own modules. While every provider was engine-shipped that was invisible. It stopped being\n * true with `providers/slack` (#341), the first provider shipped as its own package, and it\n * becomes routine once the loading slice (#330) lets an application compose one.\n *\n * The consequence was not a missing feature but a SILENT SECURITY REGRESSION, in two places at\n * once:\n *\n * - a package-shipped provider's key is attributable to no provider, so it is not classified\n * sensitive — it can land in a Kubernetes `ConfigMap` instead of a `Secret`;\n * - the per-runtime confinement filter allow-listed by the same registry and KEPT any key it\n * could not attribute, \"because it is configuration rather than a provider secret\" — so the\n * key was copied into every worker and minion environment, which is exactly what LLM-driven\n * minion code can read.\n *\n * Neither logged, warned or refused. That is why the plan orders this slice BEFORE the loader.\n *\n * ## The two sources, one shape\n *\n * | tier | source | carries |\n * |---|---|---|\n * | engine | `EngineBackendProviderRegistry.modules` | metadata, capabilities, `secretsContract`, and the full `protocols[]` runtime contracts |\n * | package / application | {@link ProviderCompanionContribution} | the same, MINUS the runtime contracts (a contribution is values-free DATA, so the CLI can read a provider whose backend module it cannot import) |\n *\n * **For CLASSIFICATION and CONFINEMENT, a contribution-sourced entry loses nothing, and that is\n * measured rather than assumed.** Across all 22 engine providers, every `secretRef` named by any\n * protocol's `runtimeContract` is already an `envVarName` declared in that same provider's\n * `secretsContract` — zero exceptions, 25 occurrences. So `secretsContractShape` is a COMPLETE\n * attribution source for those two questions: a package provider that ships only a `./companion`\n * export is classified and confined exactly as well as an engine one.\n *\n * **The converse does NOT hold, and one consumer depends on it.** The contract half is a strict\n * SUPERSET of what the bindings name — 13 engine contract keys are named by no binding at all\n * (every `IMMUDB_*`, `POSTHOG_PROJECT_API_KEY`, `BETTERSTACK_SOURCE_TOKEN`,\n * `ODOO_BASE_URL`/`_DB`/`_LOGIN`) — so anything that enumerates BINDINGS rather than the contract\n * sees less than the whole provider. `wildo config sync` builds the CI\n * `WILDO_SECRET_PROVIDER_ENV_*` block that way, so a contribution-sourced provider (zero bindings)\n * contributes zero CI secret keys. That gap is pre-existing for those 13 engine keys and is\n * tracked as issue #361; do not read the paragraph above as saying `protocolBindings: []` is\n * harmless everywhere. It is harmless for the two questions this module answers.\n *\n * ## Why registration is a door rather than a constructor argument\n *\n * Discovery of an application's provider packages necessarily runs AFTER this module is\n * imported — `credentials.schemas.ts` evaluates its sensitive-key set at module load, on the\n * first import of the CLI's credential layer. So composition cannot be an argument threaded\n * from a caller; it is a registration the discovery walk performs once it knows the\n * application, and every derived view recomputes from it. See {@link catalogueGeneration}.\n *\n * The engine tier is never registered and never removed: it is the floor.\n */\n\nimport {\n EngineBackendProviderRegistry,\n type BackendProtocolBinding,\n type BackendProviderModule,\n} from '@wildo-ai/external-connectors-private/backend';\nimport {\n resolveValidatedSaasProviderContributions,\n type DiscoveredProviderCompanionContribution,\n type WildoSaasConfig,\n} from '@wildo-ai/platform-config-lib';\nimport type { ProviderCompanionContribution } from '@wildo-ai/saas-models';\n\n/**\n * The identity half a catalogue entry carries: package, tier, vendor, origin.\n *\n * Taken from the CONTRIBUTION's inferred type rather than from `ProviderIdentity`, because the\n * two disagree on `origin`: the hand-written `ProviderIdentity` narrows it to the three-member\n * union (`catalogue` present iff `GENERATED`), while the contribution schema types the field\n * straight off `z.infer`, where it is the flat object the union's members all satisfy. This is\n * therefore the widest common shape — an engine module's `ProviderMetadata` assigns to it, and a\n * contribution's does too, with no cast on either side. Narrowing the wire record is territory A's\n * decision, not this slice's.\n */\nexport type ProviderCatalogueIdentity = NonNullable<ProviderCompanionContribution['identity']>;\n\n/** One secret a provider declares, values-free. Mirrors `ProviderSecretContractShapeEntry`. */\nexport interface ProviderCatalogueSecret {\n /** The provider-owned stable slug (the `secretsContract` key). */\n slug: string;\n /** The environment variable that carries the value. */\n envVarName: string;\n /** The provider refuses to boot without it once enabled. */\n required: boolean;\n description?: string;\n}\n\n/**\n * One provider as the CLI's secrets layer sees it, whatever tier shipped it.\n *\n * Deliberately NOT `BackendProviderModule`: that type is only constructible by importing a\n * provider's backend module, which is precisely what a package-shipped provider makes\n * impossible for tooling. This is the intersection the secrets layer actually needs.\n */\nexport interface ProviderSecretsCatalogueEntry {\n providerRef: string;\n /** Operator-facing label. Falls back to the ref — a contribution carries no display name. */\n label: string;\n /** Package / tier / vendor / origin, when the source declares it. */\n identity?: ProviderCatalogueIdentity;\n providerCapabilities: readonly string[];\n /**\n * Sorted by slug. Uniqueness on both slug and env-var name is enforced by\n * `ProviderCompanionContributionSchema` at the WIRE boundary — which this door is not — so the\n * ordering is re-established here rather than assumed, and uniqueness is a caller obligation\n * that {@link registerDiscoveredProviderContributions} deliberately does not re-parse.\n */\n secrets: readonly ProviderCatalogueSecret[];\n /**\n * The provider's protocol bindings — EMPTY for a contribution-sourced entry, because a\n * runtime contract is code and a contribution is data. Consumers that need bindings must\n * tolerate the empty case rather than treating it as an unknown provider.\n */\n protocolBindings: readonly BackendProtocolBinding[];\n /**\n * The OTLP auth hint, when the source is a loadable module. A contribution does not carry it,\n * so a package-shipped telemetry provider currently yields no header — the same outcome as an\n * engine provider that declares none, and a gap owed to whichever slice makes the hint\n * companion-safe.\n */\n otlpAuth?: BackendProviderModule['otlpAuth'];\n}\n\n// ---------------------------------------------------------------------------\n// Composition state\n// ---------------------------------------------------------------------------\n\n/** Registered non-engine contributions, keyed by ref. */\nconst discoveredContributions = new Map<string, ProviderCompanionContribution>();\n\n/**\n * Bumped by every registration and reset. Derived views memoise against it, so a view computed\n * before discovery cannot survive discovery — the stale-singleton failure this slice removes.\n */\nlet catalogueGeneration = 0;\n\n/**\n * Register provider contributions discovered outside the engine registry.\n *\n * This is the door the package-provider discovery walk (#330) calls once it has resolved an\n * application's declared provider packages and read their `./companion` exports. Idempotent by\n * ref: registering the same ref twice replaces the entry rather than duplicating it, so a\n * re-run of discovery is safe.\n *\n * A ref that the ENGINE already ships is ignored, deliberately and loudly: the engine tier is\n * the floor, and a package silently shadowing an engine provider's secret contract is exactly\n * the substitution this layer must not perform.\n */\nexport function registerDiscoveredProviderContributions(\n contributions: readonly ProviderCompanionContribution[],\n): void {\n for (const contribution of contributions) {\n if (EngineBackendProviderRegistry.getProviderByRef(contribution.ref as never)) {\n // eslint-disable-next-line no-console\n console.warn(\n `[provider-catalogue] Contribution for '${contribution.ref}' is ignored: an engine-shipped `\n + 'provider already owns that ref, and the engine tier is authoritative for its secrets contract.',\n );\n continue;\n }\n discoveredContributions.set(contribution.ref, contribution);\n }\n catalogueGeneration += 1;\n}\n\n/**\n * Discover an application's provider contributions AND register them, as one step.\n *\n * ## Why the pairing, and why here (2026-09-09)\n *\n * `resolveValidatedSaasProviderContributions` already pairs the WALK with the VALIDATION, for the\n * reason its own JSDoc gives: three correct call sites with nothing making a fourth correct is the\n * shape `.claude/rules/invariant-call-site-enumeration.md` is about. This is the same defect one\n * step further along — every CLI caller resolved contributions and none of them registered the\n * result, so {@link getComposedProviderSecretsCatalogue} was ENGINE-TIER ONLY in every CLI process\n * that had, moments earlier, read the full catalogue off disk.\n *\n * What that cost is not abstract. {@link filterProviderEnvToScope} attributes a `providerEnv` key\n * by asking this catalogue which provider declares it, and drops what it cannot attribute. So an\n * application that declares `asana` in `providers.scopes.backend`, and authors the\n * `ASANA_CLIENT_ID` / `ASANA_CLIENT_SECRET` its generated secrets contract names, had both keys\n * dropped from the backend runtime's env — with a warning saying they \"belong to no provider the\n * CLI can see\", naming `asana` in the very list of providers the runtime was scoped to. Measured\n * 2026-09-09 on Wonder Todos: the drop reached every one of the catalogue-tier providers, which is\n * the entire OAuth2 connect lane, because a provider registration cannot reach the process that\n * performs the authorization-code exchange.\n *\n * It read as an authoring mistake and was a wiring gap. The engine tier worked throughout, which is\n * exactly why it survived: every provider the framework ships is registered by the floor, so the\n * only population that could reveal this is the one nobody had authored a secret for yet.\n *\n * Registration is idempotent per ref and additive, so calling this more than once in a process is\n * safe; the engine tier always wins a collision (see {@link registerDiscoveredProviderContributions}).\n */\nexport async function resolveAndRegisterSaasProviderContributions(input: {\n saasRoot: string;\n saasConfig: Pick<\n WildoSaasConfig,\n 'modules' | 'services' | 'libraries' | 'minions' | 'providers' | 'workers'\n >;\n}): Promise<DiscoveredProviderCompanionContribution[]> {\n const contributions = await resolveValidatedSaasProviderContributions(input);\n registerDiscoveredProviderContributions(contributions);\n return contributions;\n}\n\n/**\n * Drop every registered contribution. The engine tier is untouched — it is not registered.\n *\n * Used when discovery re-runs for a different application, and by tests. A CLI process that\n * handles one application never needs it.\n */\nexport function resetDiscoveredProviderContributions(): void {\n discoveredContributions.clear();\n catalogueGeneration += 1;\n}\n\n// ---------------------------------------------------------------------------\n// The composed view\n// ---------------------------------------------------------------------------\n\nfunction entryFromEngineModule(module: BackendProviderModule): ProviderSecretsCatalogueEntry {\n const secretsContract = module.secretsContract as Record<\n string,\n { envVarName: string; required?: boolean; description?: string }\n >;\n return {\n providerRef: module.metadata.ref,\n label: module.metadata.displayName ?? module.metadata.ref,\n identity: {\n packageName: module.metadata.packageName,\n tier: module.metadata.tier,\n vendor: module.metadata.vendor,\n origin: module.metadata.origin,\n },\n providerCapabilities: [...module.providerCapabilities],\n secrets: Object.entries(secretsContract ?? {})\n .map(([slug, entry]) => ({\n slug,\n envVarName: entry.envVarName,\n required: Boolean(entry.required),\n description: entry.description,\n }))\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n protocolBindings: module.protocols,\n otlpAuth: module.otlpAuth,\n };\n}\n\nfunction entryFromContribution(\n contribution: ProviderCompanionContribution,\n): ProviderSecretsCatalogueEntry {\n return {\n providerRef: contribution.ref,\n // A contribution carries `identity` but no display name — the metadata field is\n // frontend-facing copy and stays out of the values-free wire record. The ref is the honest\n // fallback, and it is what an unnamed engine provider gets too.\n label: contribution.ref,\n identity: contribution.identity,\n providerCapabilities: contribution.providerCapabilities ?? [],\n secrets: (contribution.secretsContractShape ?? [])\n .map((entry) => ({\n slug: entry.slug,\n envVarName: entry.envVarName,\n required: entry.required,\n description: entry.description,\n }))\n // Re-sorted rather than trusted: the schema orders these, but this door accepts a\n // contribution object, not a parsed wire record, so the ordering is only guaranteed where it\n // is performed. The engine branch sorts for the same reason.\n .sort((left, right) => left.slug.localeCompare(right.slug)),\n protocolBindings: [],\n };\n}\n\nlet cachedCatalogue: ReadonlyMap<string, ProviderSecretsCatalogueEntry> | undefined;\nlet cachedCatalogueGeneration = -1;\n\n/**\n * Every provider the CLI can currently see: the engine tier, plus whatever discovery has\n * registered. Insertion order is engine-first, then registration order, so callers that sort\n * (the setup catalogue) and callers that do not (classification) both stay deterministic.\n */\nexport function getComposedProviderSecretsCatalogue(): ReadonlyMap<string, ProviderSecretsCatalogueEntry> {\n if (cachedCatalogue && cachedCatalogueGeneration === catalogueGeneration) return cachedCatalogue;\n\n const catalogue = new Map<string, ProviderSecretsCatalogueEntry>();\n for (const module of EngineBackendProviderRegistry.modules.values()) {\n catalogue.set(module.metadata.ref, entryFromEngineModule(module));\n }\n for (const contribution of discoveredContributions.values()) {\n if (catalogue.has(contribution.ref)) continue;\n catalogue.set(contribution.ref, entryFromContribution(contribution));\n }\n\n cachedCatalogue = catalogue;\n cachedCatalogueGeneration = catalogueGeneration;\n return catalogue;\n}\n\n/** One provider by ref, or `undefined` when nothing in the composed catalogue claims it. */\nexport function getComposedProviderEntry(providerRef: string): ProviderSecretsCatalogueEntry | undefined {\n return getComposedProviderSecretsCatalogue().get(providerRef);\n}\n\n/**\n * Memoise a value derived from the composed catalogue, invalidated by registration.\n *\n * The point is not speed. It is that a derived view CANNOT be a module-load snapshot: the\n * previous `PROVIDER_SENSITIVE_ENV_KEYS` was computed the moment its module was imported, which\n * is always before discovery could have run, so a composed catalogue would have been silently\n * ignored by the very classification it exists to feed.\n */\nexport function memoiseOverCatalogue<T>(compute: () => T): () => T {\n let cached: T | undefined;\n let cachedGeneration = -1;\n return () => {\n if (cachedGeneration !== catalogueGeneration) {\n cached = compute();\n cachedGeneration = catalogueGeneration;\n }\n return cached as T;\n };\n}\n\n/**\n * A `ReadonlySet<string>` whose contents are recomputed from the composed catalogue on every\n * read, rather than frozen when the module was imported.\n *\n * Exists so `PROVIDER_SENSITIVE_ENV_KEYS` and `SENSITIVE_ENV_KEYS` can keep their exported\n * NAMES and their `.has()` shape while becoming composition-aware — their consumers\n * (`k8s-secrets-generator.service.ts`, `sync.command.ts`) live outside this slice's territory\n * and must not need an edit to stay correct.\n */\nexport class LiveEnvKeySet implements ReadonlySet<string> {\n constructor(private readonly resolve: () => ReadonlySet<string>) {}\n\n get size(): number { return this.resolve().size; }\n has(key: string): boolean { return this.resolve().has(key); }\n forEach(callback: (value: string, value2: string, set: ReadonlySet<string>) => void, thisArg?: unknown): void {\n for (const key of this.resolve()) callback.call(thisArg, key, key, this);\n }\n // Return types are read OFF `ReadonlySet` rather than spelled as `IterableIterator`: the\n // standard library renamed these to `SetIterator` (which also carries `[Symbol.dispose]`) in a\n // recent lib, so a spelled-out type breaks on one lib version or the other.\n keys(): ReturnType<ReadonlySet<string>['keys']> { return this.resolve().keys(); }\n values(): ReturnType<ReadonlySet<string>['values']> { return this.resolve().values(); }\n entries(): ReturnType<ReadonlySet<string>['entries']> { return this.resolve().entries(); }\n [Symbol.iterator](): ReturnType<ReadonlySet<string>[typeof Symbol.iterator]> { return this.resolve()[Symbol.iterator](); }\n}\n"]}
@@ -55,6 +55,27 @@ export declare enum WildoCliInitAdminEnvKeys {
55
55
  WILDO_INIT_ADMIN_LASTNAME = "WILDO_INIT_ADMIN_LASTNAME",
56
56
  WILDO_INIT_ADMIN_PASSWORD = "WILDO_INIT_ADMIN_PASSWORD"
57
57
  }
58
+ /**
59
+ * The same one-shot CLI contract, for the SECOND administrator (#575).
60
+ *
61
+ * A separate enum rather than four more members on {@link WildoCliInitAdminEnvKeys}, because the two
62
+ * identities have different provenance rules and a shared enum would hide that. The admin's fields
63
+ * are always operator-authored; the approver's are operator-authored on a REMOTE environment and
64
+ * DERIVED from the admin on a local one. Reading them from one vocabulary invites a caller to treat
65
+ * a derived value and a stated one as interchangeable, which is the whole distinction
66
+ * {@link resolveApproverIdentity} exists to keep.
67
+ *
68
+ * Unlike the admin keys the PASSWORD is not optional-with-a-generator here: locally the approver
69
+ * shares the admin's password by construction, and remotely a generated password nobody was told
70
+ * about would produce an approver who cannot sign in — an account that exists and cannot act is
71
+ * worse than a refusal, because the refusal is the part that gets fixed.
72
+ */
73
+ export declare enum WildoCliInitApproverEnvKeys {
74
+ WILDO_INIT_APPROVER_EMAIL = "WILDO_INIT_APPROVER_EMAIL",
75
+ WILDO_INIT_APPROVER_FIRSTNAME = "WILDO_INIT_APPROVER_FIRSTNAME",
76
+ WILDO_INIT_APPROVER_LASTNAME = "WILDO_INIT_APPROVER_LASTNAME",
77
+ WILDO_INIT_APPROVER_PASSWORD = "WILDO_INIT_APPROVER_PASSWORD"
78
+ }
58
79
  export interface ProviderKeysInput {
59
80
  /**
60
81
  * Provider secrets keyed by their exact env-var name (e.g. `OPENAI_API_KEY`,
@@ -121,6 +142,12 @@ export declare const PlatformEnvSecretsJson_Schema: z.ZodObject<{
121
142
  firstName: z.ZodString;
122
143
  lastName: z.ZodString;
123
144
  }, z.core.$strip>;
145
+ approver: z.ZodOptional<z.ZodObject<{
146
+ email: z.ZodString;
147
+ password: z.ZodString;
148
+ firstName: z.ZodString;
149
+ lastName: z.ZodString;
150
+ }, z.core.$strip>>;
124
151
  atlas: z.ZodOptional<z.ZodObject<{
125
152
  apiPublicKey: z.ZodString;
126
153
  apiPrivateKey: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.schemas.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/credentials.schemas.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAIL,oBAAoB,EAEpB,cAAc,EAGd,sBAAsB,EACtB,iBAAiB,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAa3D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC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;;;;;;IAEH;;;OAGG;;;;;IAEH;;;;;;;OAOG;;IAEH;;;;;;OAMG;;IAEH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BH;;;;;;OAMG;;;;;QAIC;;;;;;WAMG;;;;;;;;;;;;;;;;;kBAsDP,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qCAAqC;;kBAGjD,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC"}
1
+ {"version":3,"file":"credentials.schemas.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/credentials.schemas.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAIL,oBAAoB,EAEpB,cAAc,EAGd,sBAAsB,EACtB,iBAAiB,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAa3D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oBAAY,wBAAwB;IAClC,sBAAsB,2BAA2B;IACjD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,2BAA2B;IACrC,yBAAyB,8BAA8B;IACvD,6BAA6B,kCAAkC;IAC/D,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;CAC9D;AAED,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MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qCAAqC;;kBAGjD,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC"}
@@ -39,6 +39,28 @@ export var WildoCliInitAdminEnvKeys;
39
39
  WildoCliInitAdminEnvKeys["WILDO_INIT_ADMIN_LASTNAME"] = "WILDO_INIT_ADMIN_LASTNAME";
40
40
  WildoCliInitAdminEnvKeys["WILDO_INIT_ADMIN_PASSWORD"] = "WILDO_INIT_ADMIN_PASSWORD";
41
41
  })(WildoCliInitAdminEnvKeys || (WildoCliInitAdminEnvKeys = {}));
42
+ /**
43
+ * The same one-shot CLI contract, for the SECOND administrator (#575).
44
+ *
45
+ * A separate enum rather than four more members on {@link WildoCliInitAdminEnvKeys}, because the two
46
+ * identities have different provenance rules and a shared enum would hide that. The admin's fields
47
+ * are always operator-authored; the approver's are operator-authored on a REMOTE environment and
48
+ * DERIVED from the admin on a local one. Reading them from one vocabulary invites a caller to treat
49
+ * a derived value and a stated one as interchangeable, which is the whole distinction
50
+ * {@link resolveApproverIdentity} exists to keep.
51
+ *
52
+ * Unlike the admin keys the PASSWORD is not optional-with-a-generator here: locally the approver
53
+ * shares the admin's password by construction, and remotely a generated password nobody was told
54
+ * about would produce an approver who cannot sign in — an account that exists and cannot act is
55
+ * worse than a refusal, because the refusal is the part that gets fixed.
56
+ */
57
+ export var WildoCliInitApproverEnvKeys;
58
+ (function (WildoCliInitApproverEnvKeys) {
59
+ WildoCliInitApproverEnvKeys["WILDO_INIT_APPROVER_EMAIL"] = "WILDO_INIT_APPROVER_EMAIL";
60
+ WildoCliInitApproverEnvKeys["WILDO_INIT_APPROVER_FIRSTNAME"] = "WILDO_INIT_APPROVER_FIRSTNAME";
61
+ WildoCliInitApproverEnvKeys["WILDO_INIT_APPROVER_LASTNAME"] = "WILDO_INIT_APPROVER_LASTNAME";
62
+ WildoCliInitApproverEnvKeys["WILDO_INIT_APPROVER_PASSWORD"] = "WILDO_INIT_APPROVER_PASSWORD";
63
+ })(WildoCliInitApproverEnvKeys || (WildoCliInitApproverEnvKeys = {}));
42
64
  // ---------------------------------------------------------------------------
43
65
  // Default credential usernames (not secrets — safe to store as constants)
44
66
  // ---------------------------------------------------------------------------
@@ -137,6 +159,34 @@ export const PlatformEnvSecretsJson_Schema = z
137
159
  firstName: z.string(),
138
160
  lastName: z.string(),
139
161
  }),
162
+ /**
163
+ * The SECOND platform administrator — the one who approves an application-wide access grant.
164
+ *
165
+ * Not a nicety. `applicationAccessGrantApproverIsDistinct` refuses `operator === approver` and
166
+ * refuses an ABSENT approver, and the application-scoped grant has deliberately no
167
+ * auto-approval branch — the schema states why: this grant names no tenant, so *"a grant that
168
+ * could approve itself would make the two-person rule ceremonial"*. A deployment with one
169
+ * administrator therefore cannot use the widest read the system offers, at all. The refusal was
170
+ * built and the party who discharges it never was (#575).
171
+ *
172
+ * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`
173
+ * written before this existed must still PARSE. Unlike a generated keypair it cannot be
174
+ * self-healed into place, because an identity is not mintable — see the note on
175
+ * `FRAMEWORK_MANAGED_SECRET_MATERIALS`' `ADMIN_PASSWORD` material, which is careful to declare
176
+ * only the password so that provisioning never invents an admin identity. An environment
177
+ * predating this acquires an approver by re-running setup, or by authoring the block.
178
+ *
179
+ * Locally this is DERIVED from `admin` (see `resolveApproverIdentity`) and shares its password,
180
+ * which makes the two-person rule ceremonial there — deliberately, because the alternative is a
181
+ * developer who cannot exercise an application-wide read at all. That is exactly why a
182
+ * non-local environment gets no derivation and must state the approver itself.
183
+ */
184
+ approver: z.object({
185
+ email: z.string(),
186
+ password: z.string(),
187
+ firstName: z.string(),
188
+ lastName: z.string(),
189
+ }).optional(),
140
190
  atlas: z.object({
141
191
  apiPublicKey: z.string(),
142
192
  apiPrivateKey: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.schemas.js","sourceRoot":"","sources":["../../../../src/services/credentials/credentials.schemas.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,0FAA0F;AAC1F,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACL,sCAAsC,EACtC,2CAA2C,EAC3C,8BAA8B,EAC9B,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAiClH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,6EAAiD,CAAA;IACjD,qFAAyD,CAAA;IACzD,mFAAuD,CAAA;IACvD,mFAAuD,CAAA;AACzD,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAqBD,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,yDAAyD,GAAG;IACvE,iBAAiB,EAAE,OAAO;IAC1B,iBAAiB,EAAE,SAAS;IAC5B,aAAa,EAAE,aAAa;IAC5B,uBAAuB,EAAE,OAAO;IAChC,gBAAgB,EAAE,OAAO;CACjB,CAAC;AAGX,+EAA+E;AAC/E,mCAAmC;AACnC,+EAA+E;AAE/E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,+CAA+C;IAC/C,GAAG,mCAAmC;IACtC,0C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sourcesContent":["// Boundary adapter: Zod schemas validate user-facing files (secrets.json, config.json)\n// against domain enums. This import direction (validation → domain types) is intentional.\nimport z from \"zod\";\nimport {\n APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ApplicationCreationVerificationConfigSchema,\n BackingServicesEnvConfigSchema,\n BackingServiceSource,\n WildoCdnConfigSchema,\n DatabaseEngine,\n PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n WildoAuthConfigSchema,\n WildoDeploymentRuntime,\n WildoLocationType,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n} from '@wildo-ai/platform-config-lib';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { PROVIDER_SENSITIVE_ENV_KEYS } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { LiveEnvKeySet, memoiseOverCatalogue } from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\n\n// ============================================================================\n// Default credential usernames (not secrets — safe to store as constants)\n// ============================================================================\n\n// ---------------------------------------------------------------------------\n// Credential input types (shared between modules and services)\n// ---------------------------------------------------------------------------\n\nexport interface AdminUserInput {\n email: string;\n firstName: string;\n lastName: string;\n /**\n * Optional operator-supplied initial password.\n *\n * When `undefined`, the secrets writer auto-generates a 16-char password\n * (preserving the historical zero-friction local-setup UX where the\n * generated password is printed at the end of `wildo setup`).\n *\n * When provided (today only via the `WILDO_INIT_ADMIN_PASSWORD` env-var\n * seed in {@link platformAdminUserModule}), the explicit value is\n * threaded into `Wildo_Application_Secrets.admin.password` and reused\n * by every downstream consumer (`secrets-writer`, `env-vars-builder`,\n * `k8s-bootstrap`, `app-bootstrap.service`). This is the single\n * non-interactive entry-point for CI flows that need a deterministic\n * admin password.\n */\n password?: string;\n}\n\n/**\n * CLI-namespaced env-var contract for non-interactive / CI-driven seeding\n * of the platform admin identity collected by `wildo setup` and by\n * `wildo init`, which mints the application's own `local` secrets.json\n * (issue #155) and reads these same seeds when no `--admin-*` flag is given.\n *\n * Why a CLI-specific namespace (`WILDO_INIT_ADMIN_*`) instead of reusing\n * the apps-manager runtime contract (`ADMIN_EMAIL` / `ADMIN_PASSWORD` /\n * `ADMIN_FIRST_NAME` / `ADMIN_LAST_NAME`):\n *\n * - The apps-manager keys describe the **running platform process's**\n * admin user (consumed by `init-mode-startup.apps-manager.service.ts`\n * in INIT mode) — they are runtime config for a long-lived service.\n *\n * - These keys describe the **operator running the CLI scaffold** —\n * one-shot input for the local setup wizard. Conflating them risks\n * accidentally seeding a CI runner's apps-manager process with the\n * developer's personal credentials (or vice-versa).\n *\n * Contract semantics (per Slice 2 / 2.3 design decision, TARGETED scope):\n * - Email / first name / last name: env value, when present, is used as\n * the prompt default. The operator can still override interactively.\n * - Password: env value, when present, is threaded directly into\n * `AdminUserInput.password` (skipping the auto-generator). When\n * absent, the secrets writer auto-generates a 16-char password — this\n * preserves the historical UX and is intentional.\n */\nexport enum WildoCliInitAdminEnvKeys {\n WILDO_INIT_ADMIN_EMAIL = 'WILDO_INIT_ADMIN_EMAIL',\n WILDO_INIT_ADMIN_FIRSTNAME = 'WILDO_INIT_ADMIN_FIRSTNAME',\n WILDO_INIT_ADMIN_LASTNAME = 'WILDO_INIT_ADMIN_LASTNAME',\n WILDO_INIT_ADMIN_PASSWORD = 'WILDO_INIT_ADMIN_PASSWORD',\n}\n\nexport interface ProviderKeysInput {\n /**\n * Provider secrets keyed by their exact env-var name (e.g. `OPENAI_API_KEY`,\n * `STRIPE_SECRET_KEY`), collected in the interactive `wildo setup` flow from\n * the registry-derived provider selection. This is the single map for ALL\n * provider secrets — there are no per-provider convenience fields; the setup\n * UX and the backend registry both address providers by env-var name.\n */\n providerEnv?: Record<string, string>;\n /**\n * GitHub ORGANIZATION integration (source-control), distinct from the GitHub\n * OAuth2 provider secret: these feed the `github` block of `secrets.json`,\n * not `providerEnv`.\n */\n githubOrgUrl?: string;\n githubAdminUser?: string;\n githubAdminToken?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Default credential usernames (not secrets — safe to store as constants)\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_PLATFORM_ENV_INTERNAL_SERVICE_CREDENTIAL_USERNAME = {\n MONGODB_ROOT_USER: 'wildo',\n VALKEY_ADMIN_USER: 'default',\n PG_ADMIN_USER: 'wildo_admin',\n RABBITMQ_ADMIN_USERNAME: 'wildo',\n MINIO_ACCESS_KEY: 'wildo',\n} as const;\n\n\n// ============================================================================\n// Sensitive env var classification\n// ============================================================================\n\n/**\n * Env var keys classified as sensitive (credentials, passwords, API keys).\n * Used to separate secret values from plain-text config when generating\n * deployment artifacts (K8s Secret vs ConfigMap, Docker env_file, etc.).\n *\n * Infrastructure keys are listed explicitly. Provider credentials come from the COMPOSED\n * provider catalogue via `PROVIDER_SENSITIVE_ENV_KEYS` — engine tier plus every provider\n * package discovery has registered.\n *\n * A LIVE view rather than a `new Set([...])` snapshot, and the difference is load-bearing\n * (#329): this module is evaluated on the CLI's first touch of the credential layer, which is\n * always before an application's provider packages have been discovered. A snapshot would have\n * frozen the answer at \"engine providers only\", so a package-shipped provider's API key would\n * have been classified as plain config and written into a Kubernetes `ConfigMap`. The static\n * halves are still snapshotted — they are compile-time constants and cannot move.\n */\nconst STATIC_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new Set([\n // Shared platform runtime env contract secrets\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n // Shared app-backend env contract secrets\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n]);\n\nexport const SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(\n // Memoised against the composition generation rather than rebuilt per `.has()`: the K8s secrets\n // generator asks this once per environment variable, and the union is only ever invalidated by a\n // registration.\n memoiseOverCatalogue(() => new Set([...STATIC_SENSITIVE_ENV_KEYS, ...PROVIDER_SENSITIVE_ENV_KEYS])),\n);\n\n// ============================================================================\n// Zod schemas for secrets.json and config.json (CLI validation)\n// ============================================================================\n\nexport const PlatformEnvSecretsJson_Schema = z\n .object({\n mongodb: z.object({\n rootUser: z.string(),\n rootPassword: z.string(),\n }).optional(),\n valkey: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }).optional(),\n postgresql: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }),\n rabbitmq: z.object({\n adminUsername: z.string(),\n adminPassword: z.string(),\n erlangCookie: z.string(),\n }),\n storage: z.object({\n accessKey: z.string(),\n secretKey: z.string(),\n }),\n platform: z.object({\n primarySecret: z.string(),\n /** Dedicated shared secret for admin operations (CLI ↔ apps-manager). */\n adminSecret: z.string(),\n appsManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }),\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair (per-service, mirrors\n * `appsManager`). Private half → crontabs (signs every SCHEDULED_CRON / MINION_TICK job\n * token); public half → apps-manager, which distributes it into each app's\n * `PLATFORM_CRONTABS_BATCHES_MANAGER` verify slot. Declared in\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` and therefore minted both at setup and by the\n * idempotent provisioning self-heal (`wildo local dev` / `wildo local up` preflight,\n * `wildo config sync`), so an environment predating the keypair acquires it on the\n * next command. `.optional()` at the schema layer (mirrors `immudb`) so a secrets.json\n * predating this fix still PARSES — but unlike immudb there is NO graceful degradation:\n * the crontabs config + apps-manager distribution FAIL-LOUD when it is absent (a missing\n * key silently dead-lettered every scheduled tick before this fix).\n */\n crontabsBatchesManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }).optional(),\n }),\n admin: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }),\n atlas: z.object({\n apiPublicKey: z.string(),\n apiPrivateKey: z.string(),\n }).optional(),\n /**\n * immudb state-signing keypair — the cryptographic whole-server-substitution defense\n * for the tamper-evident audit store (`COMPLIANCE_AUDIT_TRAIL`). Auto-generated (ECDSA\n * P-256) from the `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry — at setup for a new\n * environment, and by the idempotent provisioning self-heal for an existing one; the two\n * halves flow to DIFFERENT places and MUST NOT be conflated:\n *\n * - `stateSigningPrivateKey` (SEC1 \"EC PRIVATE KEY\" PEM) — mounted into the SELF-hosted\n * immudb server (`--signingKey`, immudb `x509.ParseECPrivateKey`) so it signs its\n * `ImmutableState`. SERVER-side ONLY: rides the k8s `immudb-secret` / the compose\n * local-data key file. NEVER injected into `providerEnv` or any app-pod env.\n * - `stateSigningPublicKey` (SPKI PEM) — pinned by the audit client via the\n * `IMMUDB_STATE_PUBLIC_KEY` provider secret; the client verifies the server's signed\n * state against it (immudb-verified-kv-client `verifyImmutableStateSignature`). A\n * substituted immudb cannot forge the signature without the private key, so substitution\n * is cryptographically caught. Public material — safe to deliver to every app runtime.\n *\n * Optional at the schema layer (mirrors mongodb/valkey): a secrets.json that lacks it\n * still validates, and immudb then runs UNSIGNED (client warns \"signing OFF\") — graceful\n * degradation, not a hard failure. That path now only survives for a CI-reconstructed\n * secrets.json (`reconstructSecretsFromEnv`, which publishes no immudb material); a\n * file-backed environment is provisioned automatically on the next CLI command.\n */\n immudb: z.object({\n stateSigningPrivateKey: z.string(),\n stateSigningPublicKey: z.string(),\n }).optional(),\n /**\n * Issue #74 — the SCRAM password `mongot` authenticates to mongod with, as a\n * `searchCoordinator`-roled user in mongod's `admin` database. Auto-generated from the\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry.\n *\n * Only the password lives here. The USERNAME is a framework-owned service identity\n * (`MONGOT_SYNC_SOURCE.USERNAME`), so it is a code constant rather than a stored value —\n * storing it would create a second place a rename has to reach.\n *\n * Both deployment lanes read THIS one value, which is the point: mongot never receives a\n * password directly, it reads a FILE, and the user it authenticates as is created by the\n * `mongodb-init` step. Three consumers of one secret is exactly the shape that drifts if\n * each lane mints its own — the immudb admin password was that defect one datastore over\n * (contract stated, k8s lane implemented, compose lane silently on the packaged default).\n *\n * `.optional()` mirrors mongodb/valkey/immudb so a secrets.json predating this parses; a\n * file-backed environment acquires it on the next self-heal, and an environment that\n * self-hosts no mongod never needs it.\n */\n mongot: z.object({\n syncSourcePassword: z.string(),\n }).optional(),\n /**\n * Protocol-aware provider credentials keyed by the actual process env var\n * name that should be injected into runtime services.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n github: z.object({\n orgUrl: z.string().optional(),\n adminUser: z.string().optional(),\n adminToken: z.string().optional(),\n }).optional(),\n });\nexport type PlatformEnvSecretsJson = z.infer<typeof PlatformEnvSecretsJson_Schema>;\n\nconst PlatformEnvStorageConfig_Schema = z.object({\n provider: z.enum(['minio']),\n useSsl: z.boolean(),\n bucket: z.string(),\n});\n\nconst PlatformEnvPostgresqlConfig_Schema = z.object({\n database: z.string(),\n sslMode: z.string(),\n});\n\n/**\n * Slice 6 / F-20 — typed external-service binding for ClamAV (managed\n * antivirus scanner): the validate command reads `host` through this\n * schema, so a typo at the persisted-config layer fails at parse time.\n */\nexport const ClamavExternalServiceSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().positive().optional(),\n tls: z.boolean().optional(),\n});\nexport type ClamavExternalServiceConfig = z.infer<typeof ClamavExternalServiceSchema>;\n\n/**\n * Slice 3 deep-review H-1 (2026-04-13): use `z.strictObject` (not `z.object`)\n * at the root so that unknown top-level keys in a persisted\n * `environments/<env>/config.json` fail-closed at parse time instead of\n * being silently stripped. Today the loader (`environment-registry.service`)\n * uses `safeParse` and treats a parse failure as a cache miss, so this\n * change does not crash the CLI at boot — but it does ensure that\n * `wildo config validate` (which calls `parse`) catches a typoed root key\n * as a hard error, matching the strict posture of `WildoSaasConfigSchema`.\n */\nexport const PlatformEnvConfigJson_Schema = z.strictObject({\n type: z.enum(WildoLocationType),\n runtime: z.enum(WildoDeploymentRuntime),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n database: z.object({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Slice 4.B.0 (2026-05-07): managed-brand identifier when\n * `source === MANAGED`. For Mongo: `'atlas'`. For Postgres:\n * one of `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' |\n * 'supabase' | 'neon' | 'render'`. Generalized from the\n * pre-reshape source-only model where `'atlas'` was a `source`\n * value.\n */\n provider: z.string().min(1).optional(),\n }),\n /**\n * Which declared backing store the APPLICATION's own resources persist to — mirrored from the\n * authored `applicationDatabase` in `wildo.infra.<env>.config.ts`.\n *\n * Distinct from `database` directly above, which is the PLATFORM's engine. The two move\n * independently: a PostgreSQL platform can host a MongoDB application and vice versa.\n *\n * OPTIONAL, and absence means MongoDB — the same default as\n * `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`, so every config.json written before\n * this field existed keeps its meaning exactly.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n }).optional(),\n infrastructure: z.object({\n storage: PlatformEnvStorageConfig_Schema,\n postgresql: PlatformEnvPostgresqlConfig_Schema,\n }),\n /**\n * Authored backing-services snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. Carries per-service overrides\n * (host/port/name/vhost/endpoint/bucket/database) that the\n * `ServiceAddressResolver`, docker-compose generator, and env-vars-builder\n * use to honor the author's intent. When omitted (legacy generated\n * configs), all consumers fall back to catalog defaults.\n *\n * Persisted shape matches the author shape 1:1 — the canonical contract\n * lives in `BackingServicesEnvConfigSchema` so a future CLI run that\n * re-syncs from infra config produces a stable JSON snapshot.\n */\n backingServices: BackingServicesEnvConfigSchema.optional(),\n /**\n * Authored `serviceAuth` policy snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. This is the SOURCE OF TRUTH for\n * platform-managed JWT TTLs (`accessTokenExpirationMinutes` /\n * `refreshTokenExpirationDays`) seeded into every `Wildo_Application_Config`\n * at apps-manager init time. Authored value > schema default (15 / 30).\n * When the field is absent at parse time, the apps-manager init defaults\n * flow falls back to `WildoAuthConfigSchema.parse({})` so the runtime\n * backend always receives a fully-defined `jwt` block.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n /**\n * Authored logging posture snapshot mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 3.5). Persisted so the runtime contract survives a\n * `wildo config sync` cycle: `env-vars-builder` reads it back to emit\n * `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS` for every long-running\n * platform/application process, and `LoggerService.loadConfiguration`\n * consumes the env vars at boot. Missing => LoggerService keeps its\n * built-in defaults (level `debug`, pino-pretty auto-detect by\n * `APPLICATION_ENV`).\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Authored OTLP telemetry posture mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 2 Phase 5). Persisted so `env-vars-builder` can project `OTEL_*` for the\n * `--import` preload across a `wildo config sync` cycle. Missing => telemetry off.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Authored per-environment external-provider SELECTION override mirrored\n * from `wildo.infra.<env>.config.ts` (2026-07-10). Persisted so\n * `env-vars-builder` can project `WILDO_PROVIDER_SELECTION_OVERRIDES` across\n * a `wildo config sync` cycle; `ExternalProvidersRegistryBackendService`\n * reads it at capability-resolution time. Missing => the app-wide\n * `wildo.saas.config.ts` selection applies unchanged.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Authored per-environment DOCUMENTATION-SITE origins mirrored from\n * `wildo.infra.<env>.config.ts`. Persisted so `env-vars-builder` can project\n * `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` across a `wildo config sync` cycle; the\n * application`s `docusaurus.config.ts` reads them and refuses a PRODUCTION build\n * when unset. Missing => the docs config falls back to its local dev defaults.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Generated snapshot of the local authored application-creation verification\n * posture. Env generation consumes this snapshot; `.env` is only its sink.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n /**\n * Public domain (`WildoInfraEnvConfig.publicDomain`) — the\n * runtime-agnostic external hostname browsers and reverse proxies\n * resolve. Required at the persisted-config layer because the\n * authored schema requires it; a hand-edited config that drops the\n * field fails Zod parse with a clear error instead of silently\n * defaulting at read time.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public subdomain map (`WildoInfraEnvConfig.serviceHosts`) —\n * mirrored from the authored infra config. `<serviceKey> → subdomain chain`\n * (or `''` for apex) under `publicDomain`. Consumed by the K8s application\n * endpoint builder + ingress generator via `buildServicePublicHost`. Optional\n * — an unauthored key falls back to `<serviceKey>.<publicDomain>`.\n */\n serviceHosts: z.record(z.string().min(1), z.string()).optional(),\n /**\n * Per-service CDN publish config (`WildoInfraEnvConfig.cdn`) — mirrored from\n * the authored infra config. `<serviceKey> → {enabled, bucket?, bucketPrefix?,\n * vendor}`. Reuses the authoritative `WildoCdnConfigSchema` from config-lib\n * (single source of truth — no loose re-declaration). Optional: an unmapped\n * or `enabled: false` service is nginx-pod-served (the default). Consumed by\n * the deploy render (nginx-skip) + `wildo frontend publish`.\n */\n cdn: z.record(z.string().min(1), WildoCdnConfigSchema).optional(),\n kubernetes: z.object({\n namespace: z.string(),\n ingressClass: z.string().optional(),\n }).optional(),\n remoteProvider: WildoRemoteProviderSchema.optional(),\n atlas: z.object({\n apiBaseUrl: z.string(),\n projectId: z.string(),\n clusterName: z.string(),\n }).optional(),\n externalServices: z\n .object({\n mongodb: z.object({ provider: z.string() }),\n valkey: z.object({ provider: z.string() }).optional(),\n storage: z.object({ provider: z.string() }),\n rabbitmq: z.object({ provider: z.string() }),\n /**\n * Optional ClamAV external-service binding (managed antivirus\n * scanner). Slice 6 / F-20: typed `host`/`port`/`tls` so the\n * validate path no longer needs an untyped cast and a downstream\n * wiring change cannot bypass schema enforcement.\n */\n clamav: ClamavExternalServiceSchema.optional(),\n })\n .optional(),\n /**\n * STRICT on purpose (5.3 review): this object is hand-edit-only for most slots (the wizard\n * authors only the Atlas mongodb entry), and every consumer does a direct property read — so a\n * typo key (`postgres`, `postgresQL`) used to be silently STRIPPED and degrade into an\n * empty-connection boot failure three layers from the misspelling. Rejecting unknown keys turns\n * the typo into a named parse error at the file that contains it.\n */\n externalEndpoints: z\n .strictObject({\n mongodb: z.object({ connectionUrl: z.string() }).optional(),\n /**\n * MANAGED PostgreSQL platform endpoint (RDS/Neon/Cloud SQL…) — the PG mirror of the\n * `mongodb.connectionUrl` slot above. Read by `emitPlatformPostgresEnv` when the platform's\n * `database.engine === POSTGRESQL` with `source: MANAGED`; a full URL for the same reason\n * Atlas is (an external endpoint's address, credentials and TLS posture arrive as one\n * opaque value the environment cannot derive).\n */\n postgresql: z.object({ connectionUrl: z.string() }).optional(),\n valkey: z.object({ host: z.string(), port: z.number() }).optional(),\n rabbitmq: z.object({ host: z.string(), port: z.number() }).optional(),\n storage: z.object({ endpoint: z.string(), port: z.number() }).optional(),\n })\n .optional(),\n}).superRefine((config, ctx) => {\n if (config.type === WildoLocationType.REMOTE && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: \"custom\",\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.kubernetes\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['kubernetes'],\n message: 'kubernetes config is required for remote Kubernetes environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.remoteProvider\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (config.externalEndpoints?.storage) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalEndpoints', 'storage'],\n message: 'externalEndpoints.storage is not supported yet; only managed MinIO wiring is currently supported',\n });\n }\n if (\n config.externalServices?.storage\n && config.externalServices.storage.provider !== 'minio'\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalServices', 'storage'],\n message: 'externalServices.storage must use provider \"minio\"; only managed MinIO wiring is currently supported',\n });\n }\n});\nexport type PlatformEnvConfigJson = z.infer<typeof PlatformEnvConfigJson_Schema>;\n\n/**\n * Generated `application-runtime-identity.json` — a per-env record mapping an\n * app slug to its apps-manager-minted `APPLICATION_ID` (a Mongo `_id`, NOT\n * derivable offline from the slug).\n *\n * Written by the credential-fetching bootstrap flows (see\n * `AppBootstrapService.prepareApplicationEnvTargets`) so the OFFLINE\n * docker-compose render paths — `wildo config sync --domain manifest` (which\n * runs LAST in a full sync and re-renders the compose file) and the\n * `wildo local up` self-heal — can bake the correct `APPLICATION_ID` literal\n * into each per-app minion/worker service without re-contacting apps-manager.\n *\n * Kept OUT of `config.json` on purpose: `config.json`\n * ({@link PlatformEnvConfigJson}) is the app-agnostic PLATFORM infra config,\n * whereas this is app-runtime IDENTITY. Keyed by slug so multiple apps sharing\n * one env-scope each resolve their own id.\n */\nexport const ApplicationRuntimeIdentityJson_Schema = z.record(\n z.string().min(1),\n z.object({ applicationId: z.string().min(1) }),\n);\nexport type ApplicationRuntimeIdentityJson = z.infer<typeof ApplicationRuntimeIdentityJson_Schema>;\n"]}
1
+ {"version":3,"file":"credentials.schemas.js","sourceRoot":"","sources":["../../../../src/services/credentials/credentials.schemas.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,0FAA0F;AAC1F,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACL,sCAAsC,EACtC,2CAA2C,EAC3C,8BAA8B,EAC9B,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,qCAAqC,EACrC,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OA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EAAE,CAAC,YAAY,CAAC;YACpB,OAAO,EAAE,kEAAkE;SAC5E,CAAC,CAAC;IACL,CAAC;IACD,IACE,MAAM,CAAC,IAAI,KAAK,iBAAiB,CAAC,MAAM;WACrC,MAAM,CAAC,OAAO,KAAK,sBAAsB,CAAC,UAAU;WACpD,CAAC,MAAM,CAAC,cAAc,EACzB,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,gBAAgB,CAAC;YACxB,OAAO,EAAE,+DAA+D;SACzE,CAAC,CAAC;IACL,CAAC;IACD,IAAI,MAAM,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QACtC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC;YACtC,OAAO,EAAE,kGAAkG;SAC5G,CAAC,CAAC;IACL,CAAC;IACD,IACE,MAAM,CAAC,gBAAgB,EAAE,OAAO;WAC7B,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,EACvD,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;YACrC,OAAO,EAAE,sGAAsG;SAChH,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EACjB,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C,CAAC","sourcesContent":["// Boundary adapter: Zod schemas validate user-facing files (secrets.json, config.json)\n// against domain enums. This import direction (validation → domain types) is intentional.\nimport z from \"zod\";\nimport {\n APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ApplicationCreationVerificationConfigSchema,\n BackingServicesEnvConfigSchema,\n BackingServiceSource,\n WildoCdnConfigSchema,\n DatabaseEngine,\n PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n WildoAuthConfigSchema,\n WildoDeploymentRuntime,\n WildoLocationType,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n} from '@wildo-ai/platform-config-lib';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { PROVIDER_SENSITIVE_ENV_KEYS } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { LiveEnvKeySet, memoiseOverCatalogue } from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\n\n// ============================================================================\n// Default credential usernames (not secrets — safe to store as constants)\n// ============================================================================\n\n// ---------------------------------------------------------------------------\n// Credential input types (shared between modules and services)\n// ---------------------------------------------------------------------------\n\nexport interface AdminUserInput {\n email: string;\n firstName: string;\n lastName: string;\n /**\n * Optional operator-supplied initial password.\n *\n * When `undefined`, the secrets writer auto-generates a 16-char password\n * (preserving the historical zero-friction local-setup UX where the\n * generated password is printed at the end of `wildo setup`).\n *\n * When provided (today only via the `WILDO_INIT_ADMIN_PASSWORD` env-var\n * seed in {@link platformAdminUserModule}), the explicit value is\n * threaded into `Wildo_Application_Secrets.admin.password` and reused\n * by every downstream consumer (`secrets-writer`, `env-vars-builder`,\n * `k8s-bootstrap`, `app-bootstrap.service`). This is the single\n * non-interactive entry-point for CI flows that need a deterministic\n * admin password.\n */\n password?: string;\n}\n\n/**\n * CLI-namespaced env-var contract for non-interactive / CI-driven seeding\n * of the platform admin identity collected by `wildo setup` and by\n * `wildo init`, which mints the application's own `local` secrets.json\n * (issue #155) and reads these same seeds when no `--admin-*` flag is given.\n *\n * Why a CLI-specific namespace (`WILDO_INIT_ADMIN_*`) instead of reusing\n * the apps-manager runtime contract (`ADMIN_EMAIL` / `ADMIN_PASSWORD` /\n * `ADMIN_FIRST_NAME` / `ADMIN_LAST_NAME`):\n *\n * - The apps-manager keys describe the **running platform process's**\n * admin user (consumed by `init-mode-startup.apps-manager.service.ts`\n * in INIT mode) — they are runtime config for a long-lived service.\n *\n * - These keys describe the **operator running the CLI scaffold** —\n * one-shot input for the local setup wizard. Conflating them risks\n * accidentally seeding a CI runner's apps-manager process with the\n * developer's personal credentials (or vice-versa).\n *\n * Contract semantics (per Slice 2 / 2.3 design decision, TARGETED scope):\n * - Email / first name / last name: env value, when present, is used as\n * the prompt default. The operator can still override interactively.\n * - Password: env value, when present, is threaded directly into\n * `AdminUserInput.password` (skipping the auto-generator). When\n * absent, the secrets writer auto-generates a 16-char password — this\n * preserves the historical UX and is intentional.\n */\nexport enum WildoCliInitAdminEnvKeys {\n WILDO_INIT_ADMIN_EMAIL = 'WILDO_INIT_ADMIN_EMAIL',\n WILDO_INIT_ADMIN_FIRSTNAME = 'WILDO_INIT_ADMIN_FIRSTNAME',\n WILDO_INIT_ADMIN_LASTNAME = 'WILDO_INIT_ADMIN_LASTNAME',\n WILDO_INIT_ADMIN_PASSWORD = 'WILDO_INIT_ADMIN_PASSWORD',\n}\n\n/**\n * The same one-shot CLI contract, for the SECOND administrator (#575).\n *\n * A separate enum rather than four more members on {@link WildoCliInitAdminEnvKeys}, because the two\n * identities have different provenance rules and a shared enum would hide that. The admin's fields\n * are always operator-authored; the approver's are operator-authored on a REMOTE environment and\n * DERIVED from the admin on a local one. Reading them from one vocabulary invites a caller to treat\n * a derived value and a stated one as interchangeable, which is the whole distinction\n * {@link resolveApproverIdentity} exists to keep.\n *\n * Unlike the admin keys the PASSWORD is not optional-with-a-generator here: locally the approver\n * shares the admin's password by construction, and remotely a generated password nobody was told\n * about would produce an approver who cannot sign in — an account that exists and cannot act is\n * worse than a refusal, because the refusal is the part that gets fixed.\n */\nexport enum WildoCliInitApproverEnvKeys {\n WILDO_INIT_APPROVER_EMAIL = 'WILDO_INIT_APPROVER_EMAIL',\n WILDO_INIT_APPROVER_FIRSTNAME = 'WILDO_INIT_APPROVER_FIRSTNAME',\n WILDO_INIT_APPROVER_LASTNAME = 'WILDO_INIT_APPROVER_LASTNAME',\n WILDO_INIT_APPROVER_PASSWORD = 'WILDO_INIT_APPROVER_PASSWORD',\n}\n\nexport interface ProviderKeysInput {\n /**\n * Provider secrets keyed by their exact env-var name (e.g. `OPENAI_API_KEY`,\n * `STRIPE_SECRET_KEY`), collected in the interactive `wildo setup` flow from\n * the registry-derived provider selection. This is the single map for ALL\n * provider secrets — there are no per-provider convenience fields; the setup\n * UX and the backend registry both address providers by env-var name.\n */\n providerEnv?: Record<string, string>;\n /**\n * GitHub ORGANIZATION integration (source-control), distinct from the GitHub\n * OAuth2 provider secret: these feed the `github` block of `secrets.json`,\n * not `providerEnv`.\n */\n githubOrgUrl?: string;\n githubAdminUser?: string;\n githubAdminToken?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Default credential usernames (not secrets — safe to store as constants)\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_PLATFORM_ENV_INTERNAL_SERVICE_CREDENTIAL_USERNAME = {\n MONGODB_ROOT_USER: 'wildo',\n VALKEY_ADMIN_USER: 'default',\n PG_ADMIN_USER: 'wildo_admin',\n RABBITMQ_ADMIN_USERNAME: 'wildo',\n MINIO_ACCESS_KEY: 'wildo',\n} as const;\n\n\n// ============================================================================\n// Sensitive env var classification\n// ============================================================================\n\n/**\n * Env var keys classified as sensitive (credentials, passwords, API keys).\n * Used to separate secret values from plain-text config when generating\n * deployment artifacts (K8s Secret vs ConfigMap, Docker env_file, etc.).\n *\n * Infrastructure keys are listed explicitly. Provider credentials come from the COMPOSED\n * provider catalogue via `PROVIDER_SENSITIVE_ENV_KEYS` — engine tier plus every provider\n * package discovery has registered.\n *\n * A LIVE view rather than a `new Set([...])` snapshot, and the difference is load-bearing\n * (#329): this module is evaluated on the CLI's first touch of the credential layer, which is\n * always before an application's provider packages have been discovered. A snapshot would have\n * frozen the answer at \"engine providers only\", so a package-shipped provider's API key would\n * have been classified as plain config and written into a Kubernetes `ConfigMap`. The static\n * halves are still snapshotted — they are compile-time constants and cannot move.\n */\nconst STATIC_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new Set([\n // Shared platform runtime env contract secrets\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n // Shared app-backend env contract secrets\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n]);\n\nexport const SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(\n // Memoised against the composition generation rather than rebuilt per `.has()`: the K8s secrets\n // generator asks this once per environment variable, and the union is only ever invalidated by a\n // registration.\n memoiseOverCatalogue(() => new Set([...STATIC_SENSITIVE_ENV_KEYS, ...PROVIDER_SENSITIVE_ENV_KEYS])),\n);\n\n// ============================================================================\n// Zod schemas for secrets.json and config.json (CLI validation)\n// ============================================================================\n\nexport const PlatformEnvSecretsJson_Schema = z\n .object({\n mongodb: z.object({\n rootUser: z.string(),\n rootPassword: z.string(),\n }).optional(),\n valkey: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }).optional(),\n postgresql: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }),\n rabbitmq: z.object({\n adminUsername: z.string(),\n adminPassword: z.string(),\n erlangCookie: z.string(),\n }),\n storage: z.object({\n accessKey: z.string(),\n secretKey: z.string(),\n }),\n platform: z.object({\n primarySecret: z.string(),\n /** Dedicated shared secret for admin operations (CLI ↔ apps-manager). */\n adminSecret: z.string(),\n appsManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }),\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair (per-service, mirrors\n * `appsManager`). Private half → crontabs (signs every SCHEDULED_CRON / MINION_TICK job\n * token); public half → apps-manager, which distributes it into each app's\n * `PLATFORM_CRONTABS_BATCHES_MANAGER` verify slot. Declared in\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` and therefore minted both at setup and by the\n * idempotent provisioning self-heal (`wildo local dev` / `wildo local up` preflight,\n * `wildo config sync`), so an environment predating the keypair acquires it on the\n * next command. `.optional()` at the schema layer (mirrors `immudb`) so a secrets.json\n * predating this fix still PARSES — but unlike immudb there is NO graceful degradation:\n * the crontabs config + apps-manager distribution FAIL-LOUD when it is absent (a missing\n * key silently dead-lettered every scheduled tick before this fix).\n */\n crontabsBatchesManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }).optional(),\n }),\n admin: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }),\n /**\n * The SECOND platform administrator — the one who approves an application-wide access grant.\n *\n * Not a nicety. `applicationAccessGrantApproverIsDistinct` refuses `operator === approver` and\n * refuses an ABSENT approver, and the application-scoped grant has deliberately no\n * auto-approval branch — the schema states why: this grant names no tenant, so *\"a grant that\n * could approve itself would make the two-person rule ceremonial\"*. A deployment with one\n * administrator therefore cannot use the widest read the system offers, at all. The refusal was\n * built and the party who discharges it never was (#575).\n *\n * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`\n * written before this existed must still PARSE. Unlike a generated keypair it cannot be\n * self-healed into place, because an identity is not mintable — see the note on\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS`' `ADMIN_PASSWORD` material, which is careful to declare\n * only the password so that provisioning never invents an admin identity. An environment\n * predating this acquires an approver by re-running setup, or by authoring the block.\n *\n * Locally this is DERIVED from `admin` (see `resolveApproverIdentity`) and shares its password,\n * which makes the two-person rule ceremonial there — deliberately, because the alternative is a\n * developer who cannot exercise an application-wide read at all. That is exactly why a\n * non-local environment gets no derivation and must state the approver itself.\n */\n approver: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }).optional(),\n atlas: z.object({\n apiPublicKey: z.string(),\n apiPrivateKey: z.string(),\n }).optional(),\n /**\n * immudb state-signing keypair — the cryptographic whole-server-substitution defense\n * for the tamper-evident audit store (`COMPLIANCE_AUDIT_TRAIL`). Auto-generated (ECDSA\n * P-256) from the `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry — at setup for a new\n * environment, and by the idempotent provisioning self-heal for an existing one; the two\n * halves flow to DIFFERENT places and MUST NOT be conflated:\n *\n * - `stateSigningPrivateKey` (SEC1 \"EC PRIVATE KEY\" PEM) — mounted into the SELF-hosted\n * immudb server (`--signingKey`, immudb `x509.ParseECPrivateKey`) so it signs its\n * `ImmutableState`. SERVER-side ONLY: rides the k8s `immudb-secret` / the compose\n * local-data key file. NEVER injected into `providerEnv` or any app-pod env.\n * - `stateSigningPublicKey` (SPKI PEM) — pinned by the audit client via the\n * `IMMUDB_STATE_PUBLIC_KEY` provider secret; the client verifies the server's signed\n * state against it (immudb-verified-kv-client `verifyImmutableStateSignature`). A\n * substituted immudb cannot forge the signature without the private key, so substitution\n * is cryptographically caught. Public material — safe to deliver to every app runtime.\n *\n * Optional at the schema layer (mirrors mongodb/valkey): a secrets.json that lacks it\n * still validates, and immudb then runs UNSIGNED (client warns \"signing OFF\") — graceful\n * degradation, not a hard failure. That path now only survives for a CI-reconstructed\n * secrets.json (`reconstructSecretsFromEnv`, which publishes no immudb material); a\n * file-backed environment is provisioned automatically on the next CLI command.\n */\n immudb: z.object({\n stateSigningPrivateKey: z.string(),\n stateSigningPublicKey: z.string(),\n }).optional(),\n /**\n * Issue #74 — the SCRAM password `mongot` authenticates to mongod with, as a\n * `searchCoordinator`-roled user in mongod's `admin` database. Auto-generated from the\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry.\n *\n * Only the password lives here. The USERNAME is a framework-owned service identity\n * (`MONGOT_SYNC_SOURCE.USERNAME`), so it is a code constant rather than a stored value —\n * storing it would create a second place a rename has to reach.\n *\n * Both deployment lanes read THIS one value, which is the point: mongot never receives a\n * password directly, it reads a FILE, and the user it authenticates as is created by the\n * `mongodb-init` step. Three consumers of one secret is exactly the shape that drifts if\n * each lane mints its own — the immudb admin password was that defect one datastore over\n * (contract stated, k8s lane implemented, compose lane silently on the packaged default).\n *\n * `.optional()` mirrors mongodb/valkey/immudb so a secrets.json predating this parses; a\n * file-backed environment acquires it on the next self-heal, and an environment that\n * self-hosts no mongod never needs it.\n */\n mongot: z.object({\n syncSourcePassword: z.string(),\n }).optional(),\n /**\n * Protocol-aware provider credentials keyed by the actual process env var\n * name that should be injected into runtime services.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n github: z.object({\n orgUrl: z.string().optional(),\n adminUser: z.string().optional(),\n adminToken: z.string().optional(),\n }).optional(),\n });\nexport type PlatformEnvSecretsJson = z.infer<typeof PlatformEnvSecretsJson_Schema>;\n\nconst PlatformEnvStorageConfig_Schema = z.object({\n provider: z.enum(['minio']),\n useSsl: z.boolean(),\n bucket: z.string(),\n});\n\nconst PlatformEnvPostgresqlConfig_Schema = z.object({\n database: z.string(),\n sslMode: z.string(),\n});\n\n/**\n * Slice 6 / F-20 — typed external-service binding for ClamAV (managed\n * antivirus scanner): the validate command reads `host` through this\n * schema, so a typo at the persisted-config layer fails at parse time.\n */\nexport const ClamavExternalServiceSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().positive().optional(),\n tls: z.boolean().optional(),\n});\nexport type ClamavExternalServiceConfig = z.infer<typeof ClamavExternalServiceSchema>;\n\n/**\n * Slice 3 deep-review H-1 (2026-04-13): use `z.strictObject` (not `z.object`)\n * at the root so that unknown top-level keys in a persisted\n * `environments/<env>/config.json` fail-closed at parse time instead of\n * being silently stripped. Today the loader (`environment-registry.service`)\n * uses `safeParse` and treats a parse failure as a cache miss, so this\n * change does not crash the CLI at boot — but it does ensure that\n * `wildo config validate` (which calls `parse`) catches a typoed root key\n * as a hard error, matching the strict posture of `WildoSaasConfigSchema`.\n */\nexport const PlatformEnvConfigJson_Schema = z.strictObject({\n type: z.enum(WildoLocationType),\n runtime: z.enum(WildoDeploymentRuntime),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n database: z.object({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Slice 4.B.0 (2026-05-07): managed-brand identifier when\n * `source === MANAGED`. For Mongo: `'atlas'`. For Postgres:\n * one of `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' |\n * 'supabase' | 'neon' | 'render'`. Generalized from the\n * pre-reshape source-only model where `'atlas'` was a `source`\n * value.\n */\n provider: z.string().min(1).optional(),\n }),\n /**\n * Which declared backing store the APPLICATION's own resources persist to — mirrored from the\n * authored `applicationDatabase` in `wildo.infra.<env>.config.ts`.\n *\n * Distinct from `database` directly above, which is the PLATFORM's engine. The two move\n * independently: a PostgreSQL platform can host a MongoDB application and vice versa.\n *\n * OPTIONAL, and absence means MongoDB — the same default as\n * `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`, so every config.json written before\n * this field existed keeps its meaning exactly.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n }).optional(),\n infrastructure: z.object({\n storage: PlatformEnvStorageConfig_Schema,\n postgresql: PlatformEnvPostgresqlConfig_Schema,\n }),\n /**\n * Authored backing-services snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. Carries per-service overrides\n * (host/port/name/vhost/endpoint/bucket/database) that the\n * `ServiceAddressResolver`, docker-compose generator, and env-vars-builder\n * use to honor the author's intent. When omitted (legacy generated\n * configs), all consumers fall back to catalog defaults.\n *\n * Persisted shape matches the author shape 1:1 — the canonical contract\n * lives in `BackingServicesEnvConfigSchema` so a future CLI run that\n * re-syncs from infra config produces a stable JSON snapshot.\n */\n backingServices: BackingServicesEnvConfigSchema.optional(),\n /**\n * Authored `serviceAuth` policy snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. This is the SOURCE OF TRUTH for\n * platform-managed JWT TTLs (`accessTokenExpirationMinutes` /\n * `refreshTokenExpirationDays`) seeded into every `Wildo_Application_Config`\n * at apps-manager init time. Authored value > schema default (15 / 30).\n * When the field is absent at parse time, the apps-manager init defaults\n * flow falls back to `WildoAuthConfigSchema.parse({})` so the runtime\n * backend always receives a fully-defined `jwt` block.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n /**\n * Authored logging posture snapshot mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 3.5). Persisted so the runtime contract survives a\n * `wildo config sync` cycle: `env-vars-builder` reads it back to emit\n * `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS` for every long-running\n * platform/application process, and `LoggerService.loadConfiguration`\n * consumes the env vars at boot. Missing => LoggerService keeps its\n * built-in defaults (level `debug`, pino-pretty auto-detect by\n * `APPLICATION_ENV`).\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Authored OTLP telemetry posture mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 2 Phase 5). Persisted so `env-vars-builder` can project `OTEL_*` for the\n * `--import` preload across a `wildo config sync` cycle. Missing => telemetry off.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Authored per-environment external-provider SELECTION override mirrored\n * from `wildo.infra.<env>.config.ts` (2026-07-10). Persisted so\n * `env-vars-builder` can project `WILDO_PROVIDER_SELECTION_OVERRIDES` across\n * a `wildo config sync` cycle; `ExternalProvidersRegistryBackendService`\n * reads it at capability-resolution time. Missing => the app-wide\n * `wildo.saas.config.ts` selection applies unchanged.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Authored per-environment DOCUMENTATION-SITE origins mirrored from\n * `wildo.infra.<env>.config.ts`. Persisted so `env-vars-builder` can project\n * `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` across a `wildo config sync` cycle; the\n * application`s `docusaurus.config.ts` reads them and refuses a PRODUCTION build\n * when unset. Missing => the docs config falls back to its local dev defaults.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Generated snapshot of the local authored application-creation verification\n * posture. Env generation consumes this snapshot; `.env` is only its sink.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n /**\n * Public domain (`WildoInfraEnvConfig.publicDomain`) — the\n * runtime-agnostic external hostname browsers and reverse proxies\n * resolve. Required at the persisted-config layer because the\n * authored schema requires it; a hand-edited config that drops the\n * field fails Zod parse with a clear error instead of silently\n * defaulting at read time.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public subdomain map (`WildoInfraEnvConfig.serviceHosts`) —\n * mirrored from the authored infra config. `<serviceKey> → subdomain chain`\n * (or `''` for apex) under `publicDomain`. Consumed by the K8s application\n * endpoint builder + ingress generator via `buildServicePublicHost`. Optional\n * — an unauthored key falls back to `<serviceKey>.<publicDomain>`.\n */\n serviceHosts: z.record(z.string().min(1), z.string()).optional(),\n /**\n * Per-service CDN publish config (`WildoInfraEnvConfig.cdn`) — mirrored from\n * the authored infra config. `<serviceKey> → {enabled, bucket?, bucketPrefix?,\n * vendor}`. Reuses the authoritative `WildoCdnConfigSchema` from config-lib\n * (single source of truth — no loose re-declaration). Optional: an unmapped\n * or `enabled: false` service is nginx-pod-served (the default). Consumed by\n * the deploy render (nginx-skip) + `wildo frontend publish`.\n */\n cdn: z.record(z.string().min(1), WildoCdnConfigSchema).optional(),\n kubernetes: z.object({\n namespace: z.string(),\n ingressClass: z.string().optional(),\n }).optional(),\n remoteProvider: WildoRemoteProviderSchema.optional(),\n atlas: z.object({\n apiBaseUrl: z.string(),\n projectId: z.string(),\n clusterName: z.string(),\n }).optional(),\n externalServices: z\n .object({\n mongodb: z.object({ provider: z.string() }),\n valkey: z.object({ provider: z.string() }).optional(),\n storage: z.object({ provider: z.string() }),\n rabbitmq: z.object({ provider: z.string() }),\n /**\n * Optional ClamAV external-service binding (managed antivirus\n * scanner). Slice 6 / F-20: typed `host`/`port`/`tls` so the\n * validate path no longer needs an untyped cast and a downstream\n * wiring change cannot bypass schema enforcement.\n */\n clamav: ClamavExternalServiceSchema.optional(),\n })\n .optional(),\n /**\n * STRICT on purpose (5.3 review): this object is hand-edit-only for most slots (the wizard\n * authors only the Atlas mongodb entry), and every consumer does a direct property read — so a\n * typo key (`postgres`, `postgresQL`) used to be silently STRIPPED and degrade into an\n * empty-connection boot failure three layers from the misspelling. Rejecting unknown keys turns\n * the typo into a named parse error at the file that contains it.\n */\n externalEndpoints: z\n .strictObject({\n mongodb: z.object({ connectionUrl: z.string() }).optional(),\n /**\n * MANAGED PostgreSQL platform endpoint (RDS/Neon/Cloud SQL…) — the PG mirror of the\n * `mongodb.connectionUrl` slot above. Read by `emitPlatformPostgresEnv` when the platform's\n * `database.engine === POSTGRESQL` with `source: MANAGED`; a full URL for the same reason\n * Atlas is (an external endpoint's address, credentials and TLS posture arrive as one\n * opaque value the environment cannot derive).\n */\n postgresql: z.object({ connectionUrl: z.string() }).optional(),\n valkey: z.object({ host: z.string(), port: z.number() }).optional(),\n rabbitmq: z.object({ host: z.string(), port: z.number() }).optional(),\n storage: z.object({ endpoint: z.string(), port: z.number() }).optional(),\n })\n .optional(),\n}).superRefine((config, ctx) => {\n if (config.type === WildoLocationType.REMOTE && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: \"custom\",\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.kubernetes\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['kubernetes'],\n message: 'kubernetes config is required for remote Kubernetes environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.remoteProvider\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (config.externalEndpoints?.storage) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalEndpoints', 'storage'],\n message: 'externalEndpoints.storage is not supported yet; only managed MinIO wiring is currently supported',\n });\n }\n if (\n config.externalServices?.storage\n && config.externalServices.storage.provider !== 'minio'\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalServices', 'storage'],\n message: 'externalServices.storage must use provider \"minio\"; only managed MinIO wiring is currently supported',\n });\n }\n});\nexport type PlatformEnvConfigJson = z.infer<typeof PlatformEnvConfigJson_Schema>;\n\n/**\n * Generated `application-runtime-identity.json` — a per-env record mapping an\n * app slug to its apps-manager-minted `APPLICATION_ID` (a Mongo `_id`, NOT\n * derivable offline from the slug).\n *\n * Written by the credential-fetching bootstrap flows (see\n * `AppBootstrapService.prepareApplicationEnvTargets`) so the OFFLINE\n * docker-compose render paths — `wildo config sync --domain manifest` (which\n * runs LAST in a full sync and re-renders the compose file) and the\n * `wildo local up` self-heal — can bake the correct `APPLICATION_ID` literal\n * into each per-app minion/worker service without re-contacting apps-manager.\n *\n * Kept OUT of `config.json` on purpose: `config.json`\n * ({@link PlatformEnvConfigJson}) is the app-agnostic PLATFORM infra config,\n * whereas this is app-runtime IDENTITY. Keyed by slug so multiple apps sharing\n * one env-scope each resolve their own id.\n */\nexport const ApplicationRuntimeIdentityJson_Schema = z.record(\n z.string().min(1),\n z.object({ applicationId: z.string().min(1) }),\n);\nexport type ApplicationRuntimeIdentityJson = z.infer<typeof ApplicationRuntimeIdentityJson_Schema>;\n"]}
@@ -204,7 +204,7 @@ export declare const FRAMEWORK_MANAGED_SECRET_MATERIALS: readonly [{
204
204
  readonly ref: FrameworkManagedSecretMaterialRef.ADMIN_PASSWORD;
205
205
  readonly identityKeys: readonly [];
206
206
  readonly secretKeys: readonly ["admin.password"];
207
- readonly purpose: "Password of the seeded platform admin user (when not operator-supplied).";
207
+ readonly purpose: "Password of the seeded platform administrators (when not operator-supplied).";
208
208
  readonly isProvisioned: (s: PlatformEnvSecretsDraft) => boolean;
209
209
  readonly provision: (s: PlatformEnvSecretsDraft) => void;
210
210
  readonly rotate: (s: PlatformEnvSecretsDraft) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"framework-managed-secrets.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/framework-managed-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qDAAqD,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG;KACnC,CAAC,IAAI,MAAM,sBAAsB,CAAC,CAAC,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxG,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,GAC/C,sBAAsB,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,oBAAY,iCAAiC;IAC3C,uBAAuB,4BAA4B;IACnD,uBAAuB,4BAA4B;IACnD,2BAA2B,gCAAgC;IAC3D,yBAAyB,8BAA8B;IACvD,sBAAsB,2BAA2B;IACjD,yBAAyB,8BAA8B;IACvD,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;IAC/C,qCAAqC,0CAA0C;IAC/E,iDAAiD,sDAAsD;IACvG,4BAA4B,iCAAiC;IAC7D,6BAA6B,kCAAkC;IAC/D,cAAc,mBAAmB;CAClC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,GAAG,EAAE,iCAAiC,CAAC;IAChD,qGAAqG;IACrG,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACzD,gGAAgG;IAChG,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClD,yEAAyE;IACzE,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAChD;AAOD,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkPe,CAAC;AA0B/D;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EACd,CAAC;AAE9C,2DAA2D;AAC3D,MAAM,WAAW,yCAAyC;IACxD,mEAAmE;IACnE,OAAO,EAAE,sBAAsB,CAAC;IAChC,sFAAsF;IACtF,UAAU,EAAE,iCAAiC,EAAE,CAAC;IAChD,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,uBAAuB,GAC/B,yCAAyC,CAqB3C;AAED,wDAAwD;AACxD,MAAM,WAAW,qCAAqC;IACpD,mDAAmD;IACnD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gEAAgE;IAChE,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,uBAAuB,GAC/B,qCAAqC,CAmBvC"}
1
+ {"version":3,"file":"framework-managed-secrets.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/framework-managed-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAIH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qDAAqD,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG;KACnC,CAAC,IAAI,M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;;;EA0Re,CAAC;AA0B/D;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EACd,CAAC;AAE9C,2DAA2D;AAC3D,MAAM,WAAW,yCAAyC;IACxD,mEAAmE;IACnE,OAAO,EAAE,sBAAsB,CAAC;IAChC,sFAAsF;IACtF,UAAU,EAAE,iCAAiC,EAAE,CAAC;IAChD,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,uBAAuB,GAC/B,yCAAyC,CAqB3C;AAED,wDAAwD;AACxD,MAAM,WAAW,qCAAqC;IACpD,mDAAmD;IACnD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gEAAgE;IAChE,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,uBAAuB,GAC/B,qCAAqC,CAmBvC"}
@@ -308,21 +308,62 @@ export const FRAMEWORK_MANAGED_SECRET_MATERIALS = [
308
308
  },
309
309
  },
310
310
  {
311
- // The seeded admin user's password. The operator MAY type one at setup; when they do
312
- // not, the framework generates it. Only the password is framework-managed — the
313
- // identity fields (email / first / last name) are operator-authored and are NOT
314
- // declared here, so provisioning never invents an admin identity.
311
+ /*
312
+ * The seeded administrators' password. The operator MAY type one at setup; when they do not,
313
+ * the framework generates it. Only the password is framework-managed — the identity fields
314
+ * (email / first / last name) are operator-authored and are NOT declared here, so provisioning
315
+ * never invents an administrator identity.
316
+ *
317
+ * ONE MATERIAL, TWO ACCOUNTS, and that is the local convention rather than an oversight (#575).
318
+ * An application-wide access grant is approved by a SECOND administrator — the two-person rule
319
+ * refuses an approver who is its own requester — so a platform provisions two. Locally the
320
+ * approver is sub-addressed from the administrator (`ada+approver@…`, same mailbox) and SHARES
321
+ * this password, which makes the two-person rule ceremonial there. That is the accepted trade:
322
+ * the alternative is a developer who cannot exercise an application-wide read at all. A remote
323
+ * deployment states its approver, including a password of its own, and `provision` below fills
324
+ * only what is empty, so a stated password is never overwritten.
325
+ *
326
+ * `s.approver` may legitimately be absent — the block is `.optional()` so a `secrets.json`
327
+ * written before it existed still parses — and this material must then behave exactly as it
328
+ * always did rather than conjuring an approver with no identity behind it.
329
+ */
315
330
  ref: FrameworkManagedSecretMaterialRef.ADMIN_PASSWORD,
316
331
  identityKeys: [],
332
+ /*
333
+ * `admin.password` ONLY, even though `provision` also fills `approver.password`.
334
+ *
335
+ * A declared key is a promise that the key EXISTS after provisioning — the registry's own pins
336
+ * read every declared key back and require it populated and rotatable, and they are what caught
337
+ * the first version of this. `approver` is `.optional()` so a `secrets.json` predating it still
338
+ * parses, so `approver.password` cannot make that promise. The four approver paths reach a
339
+ * CI-reconstructed secrets file through `OPERATOR_TYPED_SECRET_PATHS` instead, which is the
340
+ * honest home: remotely the approver's password IS operator-typed, and locally it is copied from
341
+ * the administrator's rather than minted on its own.
342
+ */
317
343
  secretKeys: ['admin.password'],
318
- purpose: 'Password of the seeded platform admin user (when not operator-supplied).',
319
- isProvisioned: (s) => isFilled(s.admin?.password),
344
+ purpose: 'Password of the seeded platform administrators (when not operator-supplied).',
345
+ isProvisioned: (s) => isFilled(s.admin?.password) && (s.approver === undefined || isFilled(s.approver.password)),
320
346
  provision: (s) => {
321
- s.admin = { ...s.admin, password: CredentialGenerator.generatePassword(16) };
347
+ // Reuse an already-provisioned administrator password rather than minting a second one, so
348
+ // that a run which only has to fill the approver's half does not silently rotate the
349
+ // administrator's — a "provisioning" pass that changes a working credential is an outage.
350
+ const password = isFilled(s.admin?.password) ? s.admin.password : CredentialGenerator.generatePassword(16);
351
+ s.admin = { ...s.admin, password };
352
+ if (s.approver !== undefined && !isFilled(s.approver.password)) {
353
+ s.approver = { ...s.approver, password };
354
+ }
322
355
  },
323
356
  rotate: (s) => {
357
+ // Both to the SAME new value, preserving the shared-password convention across a rotation:
358
+ // the local approver exists so one developer can sign both legs, and a rotation that split
359
+ // them would leave that developer hunting a second password for no gain. Rotation is an
360
+ // explicit operator act, so overwriting a stated remote password here is its job, not a
361
+ // surprise.
362
+ const password = CredentialGenerator.generatePassword(16);
324
363
  if (s.admin)
325
- s.admin.password = CredentialGenerator.generatePassword(16);
364
+ s.admin.password = password;
365
+ if (s.approver)
366
+ s.approver.password = password;
326
367
  },
327
368
  },
328
369
  ];