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

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 (77) hide show
  1. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +49 -1
  2. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.schemas.js +36 -2
  4. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  5. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +2 -3
  6. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +2 -3
  8. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/runtime-network-topology.d.ts +0 -1
  10. package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/runtime-network-topology.js +0 -2
  12. package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
  13. package/dist/esm/config-authoring.entry.d.ts +1 -2
  14. package/dist/esm/config-authoring.entry.d.ts.map +1 -1
  15. package/dist/esm/config-authoring.entry.js +35 -2
  16. package/dist/esm/config-authoring.entry.js.map +1 -1
  17. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +0 -20
  18. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
  19. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +0 -1
  20. package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
  21. package/dist/esm/project-config/define-infra-env-config.d.ts +3 -39
  22. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  23. package/dist/esm/project-config/define-infra-env-config.js +2 -2
  24. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  25. package/dist/esm/project-config/define-saas-config.d.ts +366 -14
  26. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  27. package/dist/esm/project-config/define-saas-config.js +121 -11
  28. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  29. package/dist/esm/project-config/provider-companion-discovery.d.ts +74 -1
  30. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  31. package/dist/esm/project-config/provider-companion-discovery.js +203 -6
  32. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  33. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +41 -15
  34. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  35. package/dist/esm/project-config/provider-runtime-artifacts.js +75 -6
  36. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  37. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +7 -43
  38. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  39. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -30
  40. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  41. package/dist/esm/project-config/shared/csp-emit.d.ts +36 -5
  42. package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
  43. package/dist/esm/project-config/shared/csp-emit.js +65 -5
  44. package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
  45. package/dist/esm/project-config/shared/csp.schemas.d.ts +46 -10
  46. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  47. package/dist/esm/project-config/shared/csp.schemas.js +45 -10
  48. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  49. package/dist/esm/project-config/shared/environment.schemas.d.ts +8 -6
  50. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  51. package/dist/esm/project-config/shared/environment.schemas.js +7 -5
  52. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  53. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +18 -3
  54. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  55. package/dist/esm/project-config/shared/infra-providers.schemas.js +34 -2
  56. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  57. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +0 -2
  58. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  59. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +0 -2
  60. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  61. package/dist/esm/project-config/shared/k8s-utils.d.ts +70 -10
  62. package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
  63. package/dist/esm/project-config/shared/k8s-utils.js +75 -11
  64. package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
  65. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts +15 -15
  66. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js +15 -15
  67. package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
  68. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +30 -0
  69. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  70. package/dist/esm/project-config/shared/platform-services.schemas.js +31 -0
  71. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  72. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +14 -0
  73. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  74. package/dist/esm/workspace-scope/workspace-homes.schemas.js +2 -0
  75. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  76. package/dist/tsconfig.build.tsbuildinfo +1 -1
  77. package/package.json +7 -7
@@ -100,7 +100,55 @@ export interface AdminAppManagedDeclaration {
100
100
  providers: SaasConfigProvidersBlock;
101
101
  providerConfigurations: ProviderConfigurations;
102
102
  }
103
- declare const AdminAppManagedWorkersSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
103
+ /**
104
+ * The managed minion inventory as it travels the apps-manager wire — the ONE runtime source for
105
+ * that block, in both directions.
106
+ *
107
+ * ## Why this is exported rather than module-private
108
+ *
109
+ * It is reached at three places in this file (`AdminAppManagedDeclarationSchema` for the CLI's
110
+ * declaration, `AppBootstrapConfigMetadataResponseSchema` for what a backend fetches at boot), and
111
+ * — since 2026-09-09 — by the application backend's configuration loader in
112
+ * `@wildo-ai/saas-backend-lib`, which used to re-declare the block by hand.
113
+ *
114
+ * That hand copy is the reason this export exists, and the cost is measured rather than
115
+ * hypothetical. A consumer-side copy of a wire block is parsed with Zod's strip-unknown semantics,
116
+ * so a field added HERE and not mirrored THERE does not fail — it is silently deleted from the
117
+ * payload on the way in. It happened twice: `mode` / `schedule` (the KD-12 cron-tick path, which
118
+ * left every scheduled minion's MINION_TICK CronJob registration dead in production while the wire
119
+ * carried the data correctly) and then `platformAccess`, added the same way and stripped the same
120
+ * way. Neither surfaced as an error anywhere.
121
+ *
122
+ * Exporting the block costs nothing: `@wildo-ai/platform-config-lib`'s root index already
123
+ * re-exports this module, and the engine already imports that root, so no consumer's module graph
124
+ * changes — only the number of hand-maintained copies of this shape does.
125
+ *
126
+ * The engine keeps its OWN `AppConfiguration_MinionsSchema` (a `strictObject` typed against a named
127
+ * interface, for the TS7056 serialization-ceiling reason documented there) and does NOT collapse
128
+ * onto this one. The two are held in step by a mechanical field-parity pin in
129
+ * `engine/saas-backend-lib/src/config/__tests__/managed-runtime-inventory-parity.backend.test.ts`,
130
+ * so the remaining duplication cannot drift in silence the way this one did.
131
+ */
132
+ export declare const AdminAppManagedMinionsSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
133
+ resourceAccess: z.ZodOptional<z.ZodObject<{
134
+ read: z.ZodDefault<z.ZodArray<z.ZodString>>;
135
+ write: z.ZodDefault<z.ZodArray<z.ZodString>>;
136
+ }, z.core.$strict>>;
137
+ platformAccess: z.ZodOptional<z.ZodObject<{
138
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
+ }, z.core.$strict>>;
140
+ mode: z.ZodOptional<z.ZodEnum<{
141
+ "always-up": "always-up";
142
+ cron: "cron";
143
+ }>>;
144
+ schedule: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>>>;
146
+ /**
147
+ * The managed worker inventory as it travels the apps-manager wire. Exported for the same reason as
148
+ * `AdminAppManagedMinionsSchema` above, and held in step with the engine's
149
+ * `AppConfiguration_WorkersSchema` by the same parity pin — read that JSDoc before changing either.
150
+ */
151
+ export declare const AdminAppManagedWorkersSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
104
152
  name: z.ZodString;
105
153
  displayName: z.ZodString;
106
154
  description: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.schemas.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/bootstrap.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mCAAmC,EAExC,KAAK,sBAAsB,EAC3B,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAML,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC9B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,eAAe,EAIhB,MAAM,sDAAsD,CAAC;AAK9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAE9E;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,2BAA2B,gCAAgC;IAC3D,0BAA0B,+BAA+B;IACzD,mBAAmB,wBAAwB;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;iBAKxC,CAAC;AAE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GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;iBAmB3C,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,uCAAuC,EAG9C,CAAC,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wCAAwC;;;;;;iBAenD,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AACpG,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC"}
@@ -48,7 +48,36 @@ export const AppBootstrapCredentialsResponseSchema = z.object({
48
48
  environment: z.enum(RuntimeEnvironment),
49
49
  credentials: AppBootstrapCredentialsSchema,
50
50
  });
51
- const AdminAppManagedMinionsSchema = z.record(z.string().min(1), z.object({
51
+ /**
52
+ * The managed minion inventory as it travels the apps-manager wire — the ONE runtime source for
53
+ * that block, in both directions.
54
+ *
55
+ * ## Why this is exported rather than module-private
56
+ *
57
+ * It is reached at three places in this file (`AdminAppManagedDeclarationSchema` for the CLI's
58
+ * declaration, `AppBootstrapConfigMetadataResponseSchema` for what a backend fetches at boot), and
59
+ * — since 2026-09-09 — by the application backend's configuration loader in
60
+ * `@wildo-ai/saas-backend-lib`, which used to re-declare the block by hand.
61
+ *
62
+ * That hand copy is the reason this export exists, and the cost is measured rather than
63
+ * hypothetical. A consumer-side copy of a wire block is parsed with Zod's strip-unknown semantics,
64
+ * so a field added HERE and not mirrored THERE does not fail — it is silently deleted from the
65
+ * payload on the way in. It happened twice: `mode` / `schedule` (the KD-12 cron-tick path, which
66
+ * left every scheduled minion's MINION_TICK CronJob registration dead in production while the wire
67
+ * carried the data correctly) and then `platformAccess`, added the same way and stripped the same
68
+ * way. Neither surfaced as an error anywhere.
69
+ *
70
+ * Exporting the block costs nothing: `@wildo-ai/platform-config-lib`'s root index already
71
+ * re-exports this module, and the engine already imports that root, so no consumer's module graph
72
+ * changes — only the number of hand-maintained copies of this shape does.
73
+ *
74
+ * The engine keeps its OWN `AppConfiguration_MinionsSchema` (a `strictObject` typed against a named
75
+ * interface, for the TS7056 serialization-ceiling reason documented there) and does NOT collapse
76
+ * onto this one. The two are held in step by a mechanical field-parity pin in
77
+ * `engine/saas-backend-lib/src/config/__tests__/managed-runtime-inventory-parity.backend.test.ts`,
78
+ * so the remaining duplication cannot drift in silence the way this one did.
79
+ */
80
+ export const AdminAppManagedMinionsSchema = z.record(z.string().min(1), z.object({
52
81
  resourceAccess: MinionResourceAccessSchema.optional(),
53
82
  /**
54
83
  * R4/R5 platform-access axis. Independent of `resourceAccess` (D12) — a
@@ -70,7 +99,12 @@ const AdminAppManagedMinionsSchema = z.record(z.string().min(1), z.object({
70
99
  mode: z.enum(['always-up', 'cron']).optional(),
71
100
  schedule: z.string().min(1).optional(),
72
101
  })).default({});
73
- const AdminAppManagedWorkersSchema = z.record(z.string().min(1), z.object({
102
+ /**
103
+ * The managed worker inventory as it travels the apps-manager wire. Exported for the same reason as
104
+ * `AdminAppManagedMinionsSchema` above, and held in step with the engine's
105
+ * `AppConfiguration_WorkersSchema` by the same parity pin — read that JSDoc before changing either.
106
+ */
107
+ export const AdminAppManagedWorkersSchema = z.record(z.string().min(1), z.object({
74
108
  name: z.string().min(1),
75
109
  displayName: z.string().min(1),
76
110
  description: z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.schemas.js","sourceRoot":"","sources":["../../../../src/bootstrap/bootst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AAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAiD,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC;;;;;;;;OAQG;IACH,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC","sourcesContent":["import {\n AppConfiguration_Shared_AppIdentity_Schema,\n type AppConfiguration_Shared_AppIdentity,\n FrontendServicesConfigSchema,\n type FrontendServicesConfig,\n RuntimeEnvironment,\n} from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport {\n EngineCapabilityActivationsSchema,\n MinionPlatformAccessCarriedSchema,\n MinionResourceAccessSchema,\n ProviderConfigurationsSchema,\n SaasConfigProvidersBlockSchema,\n type EngineCapabilityActivations,\n type MinionPlatformAccessCarried,\n type MinionResourceAccess,\n type ProviderConfigurations,\n type SaasConfigProvidersBlock,\n} from '../project-config/define-saas-config';\nimport {\n AppFrontendType,\n DataAccessSchema,\n ResourceLimitsSchema,\n WorkerRuntimeSchema,\n} from '../project-config/shared/service-definitions.schemas';\nimport {\n WorkerAuthSchema,\n WorkerHttpSchema,\n} from '../project-config/define-worker-config';\nimport { WildoAuthConfigSchema } from '../project-config/shared/auth.schemas';\nimport { DatabaseEngine } from '../project-config/shared/environment.schemas';\n\n/**\n * Shared bootstrap execution mode.\n * The workflow semantics stay the same; only the executor differs.\n */\nexport enum BootstrapExecutorKind {\n LOCAL = 'local',\n REMOTE = 'remote',\n}\n\n/**\n * Shared bootstrap step identifiers.\n * These represent semantic workflow stages, not package-specific implementation details.\n */\nexport enum BootstrapStepId {\n INITIALIZE_PLATFORM = 'initialize-platform',\n ENSURE_APPLICATION = 'ensure-application',\n FETCH_BOOTSTRAP_CREDENTIALS = 'fetch-bootstrap-credentials',\n GENERATE_RUNTIME_ARTIFACTS = 'generate-runtime-artifacts',\n START_LOCAL_RUNTIME = 'start-local-runtime',\n}\n\n/**\n * Minimum bootstrap credentials required for an application backend to authenticate\n * with apps-manager and fetch its full runtime configuration.\n */\nexport const AppBootstrapCredentialsSchema = z.object({\n APPLICATION_ID: z.string().min(1),\n PLATFORM_APPLICATION_PRIMARY_SECRET: z.string().min(1),\n PLATFORM_APPS_MANAGER_URL: z.url(),\n APPLICATION_ENV: z.enum(RuntimeEnvironment),\n});\n\n/**\n * Shared response envelope returned by apps-manager when bootstrap credentials are requested.\n * Both apps-manager and CLI should rely on this same contract.\n * `environment` / `APPLICATION_ENV` describe runtime semantics for the\n * bootstrapped application process, not the project-level remote environment id.\n */\nexport const AppBootstrapCredentialsResponseSchema = z.object({\n success: z.literal(true),\n appSlug: z.string().min(1),\n environment: z.enum(RuntimeEnvironment),\n credentials: AppBootstrapCredentialsSchema,\n});\n\nexport interface AdminAppManagedDeclaration {\n app: {\n name: string;\n slug: string;\n displayName: string;\n description?: string;\n type: 'saas';\n };\n frontendServices: Array<{\n serviceName: string;\n frontendType: AppFrontendType;\n }>;\n minions: Record<string, {\n resourceAccess?: MinionResourceAccess;\n /** R4/R5 — what this minion may read about ITSELF at the platform level. Absent ⇒ nothing. */\n platformAccess?: MinionPlatformAccessCarried;\n /** KD-12 — `'cron'` minions paired with a `schedule` produce MINION_TICK CronJob records. */\n mode?: 'always-up' | 'cron';\n schedule?: string;\n }>;\n workers: Record<string, {\n name: string;\n displayName: string;\n description?: string;\n runtime: {\n type: string;\n language: string;\n };\n http: {\n port: number;\n healthPath: string;\n readyPath: string;\n metricsPath?: string;\n };\n auth: 'wildo-jwt';\n replicas: number;\n resources?: {\n cpu?: string;\n memory?: string;\n };\n dataAccess?: {\n database?: 'read-only' | 'read-write' | 'none';\n cache?: boolean;\n queue?: 'consumer' | 'producer' | 'both' | 'none';\n };\n }>;\n engineCapabilities: EngineCapabilityActivations;\n providers: SaasConfigProvidersBlock;\n providerConfigurations: ProviderConfigurations;\n}\n\nconst AdminAppManagedMinionsSchema = z.record(\n z.string().min(1),\n z.object({\n resourceAccess: MinionResourceAccessSchema.optional(),\n /**\n * R4/R5 platform-access axis. Independent of `resourceAccess` (D12) — a\n * minion may hold either, both, or neither. apps-manager reads this to\n * decide whether to mint a principal-scoped attestation at all, and\n * `buildOwnCronRecordFilter` reads it to decide whether the minion has any\n * subject to query WITH, so a field dropped here confers nothing no matter\n * what the author wrote.\n */\n platformAccess: MinionPlatformAccessCarriedSchema.optional(),\n /**\n * KD-12 cron-tick path. When `mode === 'cron'` and `schedule` is\n * provided, the backend-api's `cron-job-sync.backend.service.ts`\n * registers a `MINION_TICK` CronJob record on\n * `platform-crontabs-batches-manager` so the per-minion queue\n * (`wildo.queue.{appId}.minion-tick.{minionName}`) actually fires\n * on schedule.\n */\n mode: z.enum(['always-up', 'cron']).optional(),\n schedule: z.string().min(1).optional(),\n }),\n).default({});\n\nconst AdminAppManagedWorkersSchema = z.record(\n z.string().min(1),\n z.object({\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n http: WorkerHttpSchema,\n auth: WorkerAuthSchema,\n replicas: z.number().int().positive(),\n resources: ResourceLimitsSchema.optional(),\n dataAccess: DataAccessSchema.optional(),\n }),\n).default({});\n\n/**\n * Admin-side projection of `wildo.saas.config.ts` carried from the CLI to\n * apps-manager at app initialization / re-apply time.\n *\n * Cross-bucket trust asymmetry (Slice 3 closeout):\n * Fields in this schema fall into TWO TRUST BUCKETS that the apps-manager\n * treats differently:\n *\n * 1. AUTHORITATIVE bucket (always honored, write-through):\n * - `app.name` / `app.slug` / `app.displayName` / `app.description`\n * — `appIdentity` core (F-53 swap: `app.name` is the canonical\n * identifier, `app.displayName` is the UI label only).\n * - `frontendServices` — frontend service registry (consumed by\n * `_merge_WildoApplicationConfig` to materialise endpoints).\n * - `minions` — minion runtime inventory, currently carrying the\n * per-minion `resourceAccess` authority whitelist used by\n * `start-minion-application`.\n * - `workers` — worker runtime inventory persisted by apps-manager so\n * the control-plane can validate worker identity and serve the\n * worker bootstrap contract without re-reading authored files.\n * - `engineCapabilities`, `providers`, and `providerConfigurations`\n * — the provider runtime graph and its non-secret settings.\n *\n * 2. POLICY bucket (governed by override semantics):\n * - currently empty for provider registration. Capability activation\n * is authored as `engineCapabilities`, while provider routing is\n * materialized into `providers`.\n *\n * What is intentionally NOT here (out of bucket):\n * - JWT TTLs (`accessTokenExpirationMinutes`/`refreshTokenExpirationDays`)\n * travel via the SIBLING field `serviceAuth` on the request envelope\n * (see `AdminAppInitializeRequestSchema.serviceAuth`), NOT here.\n * This separation reflects that JWT TTLs are infra-environment policy\n * sourced from `wildo.infra.<env>.config.ts`, while\n * `managedDeclaration` projects the application-level\n * `wildo.saas.config.ts`.\n * - `dataServices.*` (Redis key prefix, S3 bucket prefix, etc.) — these\n * flow through `PlatformEnvConfigJson` env wiring, not the admin\n * declaration. The declaration carries application-level semantics\n * only.\n *\n * If you ADD a field, decide explicitly which bucket it belongs to and\n * document it in the merge service's JSDoc — silently widening the\n * declaration without consumer-side handling is the documented failure\n * mode this comment exists to prevent.\n */\nexport const AdminAppManagedDeclarationSchema = z.object({\n app: z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n type: z.literal('saas'),\n }),\n frontendServices: z.array(z.object({\n serviceName: z.string().min(1),\n frontendType: z.enum(AppFrontendType),\n })).default([]),\n minions: AdminAppManagedMinionsSchema,\n workers: AdminAppManagedWorkersSchema,\n engineCapabilities: EngineCapabilityActivationsSchema,\n providers: SaasConfigProvidersBlockSchema,\n providerConfigurations: ProviderConfigurationsSchema,\n}) as z.ZodType<AdminAppManagedDeclaration>;\n\n/**\n * WHEN an application's OWN database gets its bootstrap rows, relative to the schema those rows need.\n *\n * ## The circularity this vocabulary exists to break\n *\n * On MongoDB, seeding an application's database needed no schema — a collection springs into being on\n * first write — so provisioning could create the database and its first rows in one uninterrupted\n * step. PostgreSQL removed that luxury and exposed a genuine cycle that had always been latent:\n *\n * - apps-manager seeds the application's database during provisioning;\n * - those rows need tables, which come from the application's OWN `migrations/` directory;\n * - those migrations are applied by the application backend at boot\n * (`applyStartupPostgresMigrations`, the production door);\n * - and the backend cannot boot until it is seeded, because its execution-context creator requires\n * exactly one APPLICATION row.\n *\n * Nothing inside that circle can break it. apps-manager cannot read the application's migration files\n * — in production they ship inside the application's own image — and the backend cannot supply the\n * seed, which is authored in `wildo.saas.config.ts`. Only the DEPLOY TOOLING holds both, which is why\n * this is a two-phase contract rather than a retry, a tolerance, or a longer timeout.\n *\n * Observed 2026-08-23 on the first PostgreSQL install: provisioning aborted with\n * `relation \"applications\" does not exist`, and `wildo local dev` failed. The same order holds on\n * every lane, so per-application PostgreSQL provisioning had never completed anywhere.\n *\n * ## Why a request field rather than an inferred tolerance\n *\n * Making apps-manager silently skip seeding when the schema happens to be absent would be a\n * fail-open: provisioning would report success having left the application unbootable, and the caller\n * would have no way to tell a deferred seed from a completed one. The caller states its intent, and\n * the response states what happened — see {@link AppDatabaseSeedingOutcome}.\n */\nexport enum AppDatabaseSeedingPhase {\n /**\n * Seed now. The default, and the ONLY behaviour any pre-2026-08-23 caller can produce, so every\n * MongoDB lane and every older CLI is unchanged.\n */\n REQUIRED = 'REQUIRED',\n /**\n * Provision infrastructure and platform records, but do NOT seed the application's own database —\n * the caller is about to create its schema and will then re-invoke with {@link REQUIRED}.\n */\n DEFERRED = 'DEFERRED',\n}\n\n/**\n * What provisioning actually DID about the application's own bootstrap rows.\n *\n * Reported so a caller can never mistake a deferred seed for a completed one. The CLI treats\n * {@link DEFERRED} as expected on its first phase and FATAL on its second — an application that is\n * still unseeded after its migrations have been applied is a defect, not a state to tolerate.\n */\nexport enum AppDatabaseSeedingOutcome {\n /** Bootstrap rows exist in the application's own database. */\n SEEDED = 'SEEDED',\n /** Skipped because the caller asked for {@link AppDatabaseSeedingPhase.DEFERRED}. */\n DEFERRED = 'DEFERRED',\n /**\n * Skipped because the application has no resolved persistence target. Distinct from\n * {@link DEFERRED}: nothing the caller does next will seed it — the target itself is missing.\n */\n NO_PERSISTENCE_TARGET = 'NO_PERSISTENCE_TARGET',\n}\n\nexport const AppBootstrapFirstAdminSeedSchema = z.object({\n userTypes: z.array(z.string().min(1)).min(1),\n});\n\nconst AppBootstrapRotatedPublicKeyEntrySchema = z.object({\n kid: z.string().min(1),\n publicKey: z.string().min(1),\n /** Last observation/token instant this retired key may authenticate. */\n notAfter: z.coerce.date().optional(),\n});\n\nexport interface AppBootstrapConfigMetadataResponse {\n appSlug: string;\n appIdentity?: AppConfiguration_Shared_AppIdentity;\n frontendServices?: FrontendServicesConfig;\n minions?: Record<string, {\n resourceAccess?: MinionResourceAccess;\n /** R4/R5 — what this minion may read about ITSELF at the platform level. Absent ⇒ nothing. */\n platformAccess?: MinionPlatformAccessCarried;\n /** KD-12 — `'cron'` minions paired with a `schedule` produce MINION_TICK CronJob records. */\n mode?: 'always-up' | 'cron';\n schedule?: string;\n }>;\n workers?: Record<string, {\n name: string;\n displayName: string;\n description?: string;\n runtime: {\n type: string;\n language: string;\n };\n http: {\n port: number;\n healthPath: string;\n readyPath: string;\n metricsPath?: string;\n };\n auth: 'wildo-jwt';\n replicas: number;\n resources?: {\n cpu?: string;\n memory?: string;\n };\n dataAccess?: {\n database?: 'read-only' | 'read-write' | 'none';\n cache?: boolean;\n queue?: 'consumer' | 'producer' | 'both' | 'none';\n };\n }>;\n engineCapabilities?: EngineCapabilityActivations;\n providers?: SaasConfigProvidersBlock;\n email?: {\n isTransactionalWildoManaged: boolean;\n isMarketingWildoManaged: boolean;\n };\n providerConfigurations: ProviderConfigurations;\n jwt?: {\n publicKey: Record<string, string>;\n rotatedPublicKeys?: Record<string, Array<z.infer<typeof AppBootstrapRotatedPublicKeyEntrySchema>>>;\n accessTokenExpirationMinutes: number;\n refreshTokenExpirationDays: number;\n };\n}\n\nexport const AppBootstrapConfigMetadataResponseSchema = z.object({\n appSlug: z.string().min(1),\n appIdentity: AppConfiguration_Shared_AppIdentity_Schema.optional(),\n frontendServices: FrontendServicesConfigSchema.optional(),\n minions: AdminAppManagedMinionsSchema.optional(),\n workers: AdminAppManagedWorkersSchema.optional(),\n engineCapabilities: EngineCapabilityActivationsSchema.optional(),\n providers: SaasConfigProvidersBlockSchema.optional(),\n email: z.object({\n isTransactionalWildoManaged: z.boolean(),\n isMarketingWildoManaged: z.boolean(),\n }).optional(),\n providerConfigurations: ProviderConfigurationsSchema,\n jwt: z.object({\n publicKey: z.record(z.string(), z.string()),\n rotatedPublicKeys: z.record(\n z.string(),\n z.array(AppBootstrapRotatedPublicKeyEntrySchema),\n ).optional(),\n /**\n * Operator-authored JWT TTLs (Slice 3.3 hardening, F-24 / closeout).\n *\n * Sourced from `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}` (which itself was seeded from\n * `serviceAuth` in `wildo.infra.<env>.config.ts` at apps-manager init\n * time, falling back to `WildoAuthConfigSchema` defaults of 15 min /\n * 30 days when omitted \\u2014 access-token default tightened from 60\n * \\u2192 15 in Auth-hardening Slice A Step 5 on 2026-04-13; see the\n * file-level JSDoc on `auth.schemas.ts` for the threat-model rationale).\n * The application backend MUST consume these values at sign time\n * (`AuthTokenIssuerBackendService.issueAccessToken`,\n * `JwtBackendService.createRefreshToken`) instead of falling back to\n * developer-authored constants in `saas-config.backend.ts`.\n *\n * REQUIRED on the response (Slice 3 closeout): `_getDefault_WildoApplicationConfig`\n * always seeds these via `WildoAuthConfigSchema.parse(serviceAuth ?? {})`\n * (15 min / 30 days defaults), so any persisted\n * `Wildo_Application_Config.jwt` block has both fields populated.\n * Marking them required here lets the consumer\n * (`app-configuration-loader.backend.service.ts`) drop the\n * `accessTokenExpirationMinutes !== undefined ? ... : {}` defensive\n * spread and treat them as guaranteed values.\n */\n accessTokenExpirationMinutes: z.number().int().positive(),\n refreshTokenExpirationDays: z.number().int().positive(),\n }).optional(),\n}) as z.ZodType<AppBootstrapConfigMetadataResponse>;\n\nexport interface AppWorkerBootstrapResponse {\n appSlug: string;\n workerName: string;\n worker: z.infer<typeof AdminAppManagedWorkersSchema>[string];\n jwt: {\n publicKey: string;\n rotatedPublicKeys?: Array<z.infer<typeof AppBootstrapRotatedPublicKeyEntrySchema>>;\n };\n}\n\nexport const AppWorkerBootstrapResponseSchema = z.object({\n appSlug: z.string().min(1),\n workerName: z.string().min(1),\n worker: z.object({\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n http: WorkerHttpSchema,\n auth: WorkerAuthSchema,\n replicas: z.number().int().positive(),\n resources: ResourceLimitsSchema.optional(),\n dataAccess: DataAccessSchema.optional(),\n }),\n jwt: z.object({\n publicKey: z.string().min(1),\n rotatedPublicKeys: z.array(AppBootstrapRotatedPublicKeyEntrySchema).optional(),\n }),\n}) as z.ZodType<AppWorkerBootstrapResponse>;\n\ntype WildoAuthConfig = z.infer<typeof WildoAuthConfigSchema>;\n\nexport interface AdminAppInitializeRequest {\n name?: string;\n appDatabaseName?: string;\n override?: boolean;\n userEmail: string;\n userFirstName: string;\n userLastName: string;\n userPassword?: string;\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * The application's own persistence engine — see the field's JSDoc on the schema below for why it\n * exists at all.\n *\n * ⚠️ This interface and that schema are TWO declarations of ONE contract, joined by the\n * `as z.ZodType<AdminAppInitializeRequest>` cast. The cast means a field added to only the schema\n * type-checks perfectly while being invisible to every CONSUMER — which is exactly what happened on\n * 2026-08-19: apps-manager's controller could not read `applicationDatabase` off a parsed request\n * though the schema accepted it. Add to BOTH, always.\n */\n applicationDatabase?: { engine: DatabaseEngine; databaseName?: string };\n firstAdminSeed?: AppBootstrapFirstAdminSeed;\n /**\n * WHEN to seed this application's own database. Absent means\n * {@link AppDatabaseSeedingPhase.REQUIRED} — see that enum for why the phase is stated rather\n * than inferred.\n */\n appDatabaseSeeding?: AppDatabaseSeedingPhase;\n serviceAuth?: WildoAuthConfig;\n}\n\n/**\n * Shared admin request payload for a single app initialization.\n *\n * This describes the control-plane contract, independently of whether the\n * caller is the CLI or a future CI/CD executor.\n *\n * Required-by-contract fields:\n * - `managedDeclaration` — the projection of `wildo.saas.config.ts` that\n * seeds frontend services, capability policy, and external providers.\n * Omitting it would silently half-bootstrap an app, so the admin HTTP\n * boundary rejects requests without it.\n * - `userEmail` / `userFirstName` / `userLastName` — admin identity for\n * the seeded super-admin user. The previous implementation defaulted\n * these to a developer's personal identity, silently bypassing the\n * downstream `validateInitializationOptions` validation; that bypass\n * is now closed at the contract boundary.\n *\n * Optional-by-design fields:\n * - `userPassword` — the service auto-generates a secure password when\n * omitted (intentional one-shot bootstrap affordance).\n * - `name` / `appDatabaseName` / `override` / `firstAdminSeed` — caller\n * overrides; sensible defaults exist downstream.\n */\nexport const AdminAppInitializeRequestSchema = z.object({\n name: z.string().min(1).optional(),\n appDatabaseName: z.string().min(1).optional(),\n override: z.boolean().optional(),\n userEmail: z.email(),\n userFirstName: z.string().min(1),\n userLastName: z.string().min(1),\n userPassword: z.string().min(1).optional(),\n managedDeclaration: AdminAppManagedDeclarationSchema,\n /**\n * Which store this application's own resources persist to — mirrored from the authored\n * `applicationDatabase` in `wildo.infra.<env>.config.ts`, and carried under the SAME name so the\n * value is traceable end to end by one word.\n *\n * ## Why this field had to be added\n *\n * apps-manager already held the entire per-application PostgreSQL path: `mintAppCredentials`\n * provisioning the database, role and password, plus the `defaultAdapter` and `resourceIdFormat`\n * branches of the stored application config. All three were gated on\n * `WildoApplicationInitOptions.usePostgreSQL`, and on 2026-08-19 a repo-wide search found that flag\n * had FOUR mentions in the whole codebase — one declaration and three reads, in a single file.\n * **Nothing ever set it.**\n *\n * So the capability had no door. `backingServices.postgresql` had been authored for some time and\n * no application role ever appeared in `pg_roles`, because the declaration had no path to the\n * provisioner. This field is that path.\n *\n * OPTIONAL, and absence means MongoDB — matching\n * `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`'s own default, so an older CLI that does\n * not send it keeps exactly the behaviour every existing application already has.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n /**\n * The AUTHORED database name, from `backingServices.postgresql.database`.\n *\n * Sent because two sources were naming this database and disagreeing: the provisioner derives\n * `wildo_<sanitized-slug>` while `env-vars-builder` emits the authored name as\n * `POSTGRESQL_DATABASE`. On 2026-08-19 that produced `wildo_wonder_todos` (owned by the app role)\n * beside `wonder-todos-db` (what the backend was told to connect to) — both empty, so the\n * application would have opened a database it did not own while its grants landed elsewhere.\n *\n * The authored value wins: it is the git-borne declaration, it is what the env already carries,\n * and the provisioner has always accepted an override — the caller simply never passed one.\n */\n databaseName: z.string().min(1).optional(),\n }).optional(),\n firstAdminSeed: AppBootstrapFirstAdminSeedSchema.optional(),\n /**\n * WHEN to seed this application's own database — see {@link AppDatabaseSeedingPhase}.\n *\n * OPTIONAL, and absence means `REQUIRED`, so a CLI that predates the two-phase contract keeps\n * exactly the single-phase behaviour every MongoDB application already has.\n */\n appDatabaseSeeding: z.enum(AppDatabaseSeedingPhase).optional(),\n /**\n * Authored `serviceAuth` projection from `wildo.infra.<env>.config.ts`,\n * threaded by the CLI so apps-manager can seed\n * `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}` from the operator's policy instead of a\n * hardcoded constant. When omitted (older CLI, or infra file that does\n * not author `serviceAuth`), apps-manager applies the\n * `WildoAuthConfigSchema` defaults (15 min / 30 days as of Auth-hardening\n * Slice A Step 5 on 2026-04-13; pre-Slice-A the access-token default\n * was 60 min) at init time via `WildoAuthConfigSchema.parse({})`.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n}) as z.ZodType<AdminAppInitializeRequest>;\n\nexport interface AdminAppInitializeTarget {\n slug: string;\n name?: string;\n appDatabaseName?: string;\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * The application's own persistence engine — identical semantics to\n * {@link AdminAppInitializeRequest.applicationDatabase}, per target.\n *\n * Added 2026-08-27. The batch envelope had no way to express it, so\n * `POST /admin/apps/initialize` could only ever register applications as MongoDB — the single-app\n * endpoint carried the selection and its batch sibling silently dropped it. One invariant, two\n * call sites, applied at one (`.claude/rules/invariant-call-site-enumeration.md`).\n *\n * ⚠️ Interface AND schema, always — the `as z.ZodType<AdminAppInitializeTarget>` cast below makes\n * a schema-only addition type-check while staying invisible to every consumer.\n */\n applicationDatabase?: { engine: DatabaseEngine; databaseName?: string };\n firstAdminSeed?: AppBootstrapFirstAdminSeed;\n serviceAuth?: WildoAuthConfig;\n}\n\n/**\n * Per-target payload inside a batch admin initialization request.\n *\n * `managedDeclaration` is required for the same contract reason as in\n * `AdminAppInitializeRequestSchema`. Admin identity lives at the batch\n * envelope level (one admin user across all targets), not per target.\n */\nexport const AdminAppInitializeTargetSchema = z.object({\n slug: z.string().min(1),\n name: z.string().min(1).optional(),\n appDatabaseName: z.string().min(1).optional(),\n managedDeclaration: AdminAppManagedDeclarationSchema,\n /**\n * Per-target application persistence selection. Same shape and same meaning as\n * {@link AdminAppInitializeRequestSchema}'s field of this name — read that one for why the\n * selection must be authored rather than inferred from which backing services are declared.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n databaseName: z.string().min(1).optional(),\n }).optional(),\n firstAdminSeed: AppBootstrapFirstAdminSeedSchema.optional(),\n /**\n * Per-target `serviceAuth` projection. Today every target in a batch\n * shares the same infra-authored `serviceAuth` (one infra file per env),\n * but the field is per-target rather than batch-level so a future\n * targeted override (e.g. preview-app with a longer access TTL) can land\n * without breaking the contract. See\n * {@link AdminAppInitializeRequestSchema.serviceAuth} for full semantics.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n}) as z.ZodType<AdminAppInitializeTarget>;\n\nexport interface AdminAppsInitializeBatchRequest {\n override?: boolean;\n userEmail: string;\n userFirstName: string;\n userLastName: string;\n userPassword?: string;\n targets: AdminAppInitializeTarget[];\n}\n\n/**\n * Batch admin initialization envelope. Admin identity is required at the\n * envelope level (the seeded admin user is shared across all targets).\n */\nexport const AdminAppsInitializeBatchRequestSchema = z.object({\n override: z.boolean().optional(),\n userEmail: z.email(),\n userFirstName: z.string().min(1),\n userLastName: z.string().min(1),\n userPassword: z.string().min(1).optional(),\n targets: z.array(AdminAppInitializeTargetSchema).min(1),\n}) as z.ZodType<AdminAppsInitializeBatchRequest>;\n\nexport interface AdminAppReapplyDeclarationRequest {\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * Report what a reapply WOULD change and write nothing (issue #97).\n *\n * This is the comparison primitive behind every \"is the stored config still what the\n * application declares?\" question — the init postcondition and the `wildo local doctor`\n * drift check both ask it this way rather than each re-implementing an authored-vs-stored\n * differ. One comparison, one place it can be wrong.\n *\n * Optional and defaulting to a real reapply, so an existing caller keeps its behaviour: a flag\n * that silently turned writes into no-ops would be a far worse failure than the invisibility it\n * exists to cure.\n */\n dryRun?: boolean;\n}\n\n/**\n * Shared success response for a single app initialization request.\n */\nexport const AdminAppInitializeResponseSchema = z.object({\n success: z.literal(true),\n application: z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n }),\n credentials: z.object({\n email: z.email(),\n password: z.string().min(1),\n }),\n /**\n * What provisioning did about the application's own bootstrap rows — see\n * {@link AppDatabaseSeedingOutcome}.\n *\n * OPTIONAL so a CLI can still parse a response from an apps-manager that predates the two-phase\n * contract. A caller that DEPENDS on the two-phase flow must treat absence as \"unknown\" and say\n * so, never as `SEEDED`.\n */\n appDatabaseSeeding: z.enum(AppDatabaseSeedingOutcome).optional(),\n});\n\n/**\n * Shared admin request payload for reapplying the `wildo.saas.config.ts`\n * declaration projection (`AdminAppManagedDeclaration`) onto an\n * already-initialized application.\n *\n * Contract semantics — what this endpoint owns:\n * - Re-source the declaration-managed slices of `Wildo_Application_Config`\n * from the new declaration: `appIdentity` display fields,\n * `frontendServices` seed, `engineCapabilities`, `providers`, and\n * `providerConfigurations`.\n * - Return a `updatedFields` diff so the caller can surface what changed.\n *\n * Contract semantics — what this endpoint deliberately does NOT touch:\n * - Credentials (DB users, JWT private keys, session secrets, admin\n * passwords). Those live in `Wildo_Application_Secrets` and are owned\n * by initialize / rotate flows.\n * - Database / infrastructure provisioning. Those are owned by\n * `/admin/apps/:appSlug/initialize` and the platform-init flow.\n * - K8s endpoints. Those are owned by\n * `/admin/apps/:appSlug/refresh` (config refresh) and the deploy flow.\n * - First-admin seeding (`firstAdminSeed`). User/role seeding happens\n * at init time only. Reapplying the declaration is a config-drift\n * operation; silently changing seeded role grants would be a\n * security regression. Callers wanting to change admin user types\n * must use a dedicated admin-management endpoint (not this one).\n *\n * Stable action identifier: `apps.reapply-declaration` (see\n * {@link APPS_REAPPLY_DECLARATION_ACTION_ID} in `bootstrap.contracts.ts`).\n * The CI/CD admin rights workstream (Step 8) reuses this identifier in\n * its permission grid so this endpoint can be granted independently\n * from the broader `apps.initialize` action.\n */\nexport const AdminAppReapplyDeclarationRequestSchema = z.strictObject({\n managedDeclaration: AdminAppManagedDeclarationSchema,\n dryRun: z.boolean().optional(),\n}) as z.ZodType<AdminAppReapplyDeclarationRequest>;\n\n/**\n * Shared success response for a managed-declaration reapply request.\n *\n * `updatedFields` lists the dot-paths of the declaration-projection\n * slices that actually changed (e.g. `appIdentity.displayName`,\n * `frontendServices`, `engineCapabilities`, `providers`).\n * An empty list means the stored config already matched the new\n * declaration — the operation is idempotent.\n *\n * When `dryRun` is `true` the same list describes what WOULD change; nothing\n * was written. An empty `updatedFields` under `dryRun` is therefore a positive\n * coherence proof: the stored config matches the declaration right now.\n */\nexport const AdminAppReapplyDeclarationResponseSchema = z.object({\n success: z.literal(true),\n appSlug: z.string().min(1),\n updatedFields: z.array(z.string()),\n appliedAt: z.string().datetime(),\n /**\n * Whether this response describes a PREVIEW or an APPLIED change.\n *\n * REQUIRED rather than optional, and echoed from the request rather than assumed by the\n * caller: `updatedFields` reads identically in both modes, so `['providerConfigurations']`\n * means two opposite things depending on this flag. A caller that cannot tell them apart may\n * report \"reapplied\" for a run that changed nothing on the server. Issue #97 is what a\n * silently implicit answer to \"did this actually take?\" costs.\n */\n dryRun: z.boolean(),\n});\n\nexport type AppBootstrapCredentials = z.infer<typeof AppBootstrapCredentialsSchema>;\nexport type AppBootstrapCredentialsResponse = z.infer<typeof AppBootstrapCredentialsResponseSchema>;\nexport type AppBootstrapFirstAdminSeed = z.infer<typeof AppBootstrapFirstAdminSeedSchema>;\nexport type AdminAppInitializeResponse = z.infer<typeof AdminAppInitializeResponseSchema>;\nexport type AdminAppReapplyDeclarationResponse = z.infer<typeof AdminAppReapplyDeclarationResponseSchema>;\n"]}
1
+ {"version":3,"file":"bootstrap.schemas.js","sourceRoot":"","sources":["../../../../src/bootstrap/bootstrap.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAE1C,4BAA4B,EAE5B,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,GAM/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAE9E;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/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_Shared_AppIdentity_Schema,\n type AppConfiguration_Shared_AppIdentity,\n FrontendServicesConfigSchema,\n type FrontendServicesConfig,\n RuntimeEnvironment,\n} from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport {\n EngineCapabilityActivationsSchema,\n MinionPlatformAccessCarriedSchema,\n MinionResourceAccessSchema,\n ProviderConfigurationsSchema,\n SaasConfigProvidersBlockSchema,\n type EngineCapabilityActivations,\n type MinionPlatformAccessCarried,\n type MinionResourceAccess,\n type ProviderConfigurations,\n type SaasConfigProvidersBlock,\n} from '../project-config/define-saas-config';\nimport {\n AppFrontendType,\n DataAccessSchema,\n ResourceLimitsSchema,\n WorkerRuntimeSchema,\n} from '../project-config/shared/service-definitions.schemas';\nimport {\n WorkerAuthSchema,\n WorkerHttpSchema,\n} from '../project-config/define-worker-config';\nimport { WildoAuthConfigSchema } from '../project-config/shared/auth.schemas';\nimport { DatabaseEngine } from '../project-config/shared/environment.schemas';\n\n/**\n * Shared bootstrap execution mode.\n * The workflow semantics stay the same; only the executor differs.\n */\nexport enum BootstrapExecutorKind {\n LOCAL = 'local',\n REMOTE = 'remote',\n}\n\n/**\n * Shared bootstrap step identifiers.\n * These represent semantic workflow stages, not package-specific implementation details.\n */\nexport enum BootstrapStepId {\n INITIALIZE_PLATFORM = 'initialize-platform',\n ENSURE_APPLICATION = 'ensure-application',\n FETCH_BOOTSTRAP_CREDENTIALS = 'fetch-bootstrap-credentials',\n GENERATE_RUNTIME_ARTIFACTS = 'generate-runtime-artifacts',\n START_LOCAL_RUNTIME = 'start-local-runtime',\n}\n\n/**\n * Minimum bootstrap credentials required for an application backend to authenticate\n * with apps-manager and fetch its full runtime configuration.\n */\nexport const AppBootstrapCredentialsSchema = z.object({\n APPLICATION_ID: z.string().min(1),\n PLATFORM_APPLICATION_PRIMARY_SECRET: z.string().min(1),\n PLATFORM_APPS_MANAGER_URL: z.url(),\n APPLICATION_ENV: z.enum(RuntimeEnvironment),\n});\n\n/**\n * Shared response envelope returned by apps-manager when bootstrap credentials are requested.\n * Both apps-manager and CLI should rely on this same contract.\n * `environment` / `APPLICATION_ENV` describe runtime semantics for the\n * bootstrapped application process, not the project-level remote environment id.\n */\nexport const AppBootstrapCredentialsResponseSchema = z.object({\n success: z.literal(true),\n appSlug: z.string().min(1),\n environment: z.enum(RuntimeEnvironment),\n credentials: AppBootstrapCredentialsSchema,\n});\n\nexport interface AdminAppManagedDeclaration {\n app: {\n name: string;\n slug: string;\n displayName: string;\n description?: string;\n type: 'saas';\n };\n frontendServices: Array<{\n serviceName: string;\n frontendType: AppFrontendType;\n }>;\n minions: Record<string, {\n resourceAccess?: MinionResourceAccess;\n /** R4/R5 — what this minion may read about ITSELF at the platform level. Absent ⇒ nothing. */\n platformAccess?: MinionPlatformAccessCarried;\n /** KD-12 — `'cron'` minions paired with a `schedule` produce MINION_TICK CronJob records. */\n mode?: 'always-up' | 'cron';\n schedule?: string;\n }>;\n workers: Record<string, {\n name: string;\n displayName: string;\n description?: string;\n runtime: {\n type: string;\n language: string;\n };\n http: {\n port: number;\n healthPath: string;\n readyPath: string;\n metricsPath?: string;\n };\n auth: 'wildo-jwt';\n replicas: number;\n resources?: {\n cpu?: string;\n memory?: string;\n };\n dataAccess?: {\n database?: 'read-only' | 'read-write' | 'none';\n cache?: boolean;\n queue?: 'consumer' | 'producer' | 'both' | 'none';\n };\n }>;\n engineCapabilities: EngineCapabilityActivations;\n providers: SaasConfigProvidersBlock;\n providerConfigurations: ProviderConfigurations;\n}\n\n/**\n * The managed minion inventory as it travels the apps-manager wire — the ONE runtime source for\n * that block, in both directions.\n *\n * ## Why this is exported rather than module-private\n *\n * It is reached at three places in this file (`AdminAppManagedDeclarationSchema` for the CLI's\n * declaration, `AppBootstrapConfigMetadataResponseSchema` for what a backend fetches at boot), and\n * — since 2026-09-09 — by the application backend's configuration loader in\n * `@wildo-ai/saas-backend-lib`, which used to re-declare the block by hand.\n *\n * That hand copy is the reason this export exists, and the cost is measured rather than\n * hypothetical. A consumer-side copy of a wire block is parsed with Zod's strip-unknown semantics,\n * so a field added HERE and not mirrored THERE does not fail — it is silently deleted from the\n * payload on the way in. It happened twice: `mode` / `schedule` (the KD-12 cron-tick path, which\n * left every scheduled minion's MINION_TICK CronJob registration dead in production while the wire\n * carried the data correctly) and then `platformAccess`, added the same way and stripped the same\n * way. Neither surfaced as an error anywhere.\n *\n * Exporting the block costs nothing: `@wildo-ai/platform-config-lib`'s root index already\n * re-exports this module, and the engine already imports that root, so no consumer's module graph\n * changes — only the number of hand-maintained copies of this shape does.\n *\n * The engine keeps its OWN `AppConfiguration_MinionsSchema` (a `strictObject` typed against a named\n * interface, for the TS7056 serialization-ceiling reason documented there) and does NOT collapse\n * onto this one. The two are held in step by a mechanical field-parity pin in\n * `engine/saas-backend-lib/src/config/__tests__/managed-runtime-inventory-parity.backend.test.ts`,\n * so the remaining duplication cannot drift in silence the way this one did.\n */\nexport const AdminAppManagedMinionsSchema = z.record(\n z.string().min(1),\n z.object({\n resourceAccess: MinionResourceAccessSchema.optional(),\n /**\n * R4/R5 platform-access axis. Independent of `resourceAccess` (D12) — a\n * minion may hold either, both, or neither. apps-manager reads this to\n * decide whether to mint a principal-scoped attestation at all, and\n * `buildOwnCronRecordFilter` reads it to decide whether the minion has any\n * subject to query WITH, so a field dropped here confers nothing no matter\n * what the author wrote.\n */\n platformAccess: MinionPlatformAccessCarriedSchema.optional(),\n /**\n * KD-12 cron-tick path. When `mode === 'cron'` and `schedule` is\n * provided, the backend-api's `cron-job-sync.backend.service.ts`\n * registers a `MINION_TICK` CronJob record on\n * `platform-crontabs-batches-manager` so the per-minion queue\n * (`wildo.queue.{appId}.minion-tick.{minionName}`) actually fires\n * on schedule.\n */\n mode: z.enum(['always-up', 'cron']).optional(),\n schedule: z.string().min(1).optional(),\n }),\n).default({});\n\n/**\n * The managed worker inventory as it travels the apps-manager wire. Exported for the same reason as\n * `AdminAppManagedMinionsSchema` above, and held in step with the engine's\n * `AppConfiguration_WorkersSchema` by the same parity pin — read that JSDoc before changing either.\n */\nexport const AdminAppManagedWorkersSchema = z.record(\n z.string().min(1),\n z.object({\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n http: WorkerHttpSchema,\n auth: WorkerAuthSchema,\n replicas: z.number().int().positive(),\n resources: ResourceLimitsSchema.optional(),\n dataAccess: DataAccessSchema.optional(),\n }),\n).default({});\n\n/**\n * Admin-side projection of `wildo.saas.config.ts` carried from the CLI to\n * apps-manager at app initialization / re-apply time.\n *\n * Cross-bucket trust asymmetry (Slice 3 closeout):\n * Fields in this schema fall into TWO TRUST BUCKETS that the apps-manager\n * treats differently:\n *\n * 1. AUTHORITATIVE bucket (always honored, write-through):\n * - `app.name` / `app.slug` / `app.displayName` / `app.description`\n * — `appIdentity` core (F-53 swap: `app.name` is the canonical\n * identifier, `app.displayName` is the UI label only).\n * - `frontendServices` — frontend service registry (consumed by\n * `_merge_WildoApplicationConfig` to materialise endpoints).\n * - `minions` — minion runtime inventory, currently carrying the\n * per-minion `resourceAccess` authority whitelist used by\n * `start-minion-application`.\n * - `workers` — worker runtime inventory persisted by apps-manager so\n * the control-plane can validate worker identity and serve the\n * worker bootstrap contract without re-reading authored files.\n * - `engineCapabilities`, `providers`, and `providerConfigurations`\n * — the provider runtime graph and its non-secret settings.\n *\n * 2. POLICY bucket (governed by override semantics):\n * - currently empty for provider registration. Capability activation\n * is authored as `engineCapabilities`, while provider routing is\n * materialized into `providers`.\n *\n * What is intentionally NOT here (out of bucket):\n * - JWT TTLs (`accessTokenExpirationMinutes`/`refreshTokenExpirationDays`)\n * travel via the SIBLING field `serviceAuth` on the request envelope\n * (see `AdminAppInitializeRequestSchema.serviceAuth`), NOT here.\n * This separation reflects that JWT TTLs are infra-environment policy\n * sourced from `wildo.infra.<env>.config.ts`, while\n * `managedDeclaration` projects the application-level\n * `wildo.saas.config.ts`.\n * - `dataServices.*` (Redis key prefix, S3 bucket prefix, etc.) — these\n * flow through `PlatformEnvConfigJson` env wiring, not the admin\n * declaration. The declaration carries application-level semantics\n * only.\n *\n * If you ADD a field, decide explicitly which bucket it belongs to and\n * document it in the merge service's JSDoc — silently widening the\n * declaration without consumer-side handling is the documented failure\n * mode this comment exists to prevent.\n */\nexport const AdminAppManagedDeclarationSchema = z.object({\n app: z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n type: z.literal('saas'),\n }),\n frontendServices: z.array(z.object({\n serviceName: z.string().min(1),\n frontendType: z.enum(AppFrontendType),\n })).default([]),\n minions: AdminAppManagedMinionsSchema,\n workers: AdminAppManagedWorkersSchema,\n engineCapabilities: EngineCapabilityActivationsSchema,\n providers: SaasConfigProvidersBlockSchema,\n providerConfigurations: ProviderConfigurationsSchema,\n}) as z.ZodType<AdminAppManagedDeclaration>;\n\n/**\n * WHEN an application's OWN database gets its bootstrap rows, relative to the schema those rows need.\n *\n * ## The circularity this vocabulary exists to break\n *\n * On MongoDB, seeding an application's database needed no schema — a collection springs into being on\n * first write — so provisioning could create the database and its first rows in one uninterrupted\n * step. PostgreSQL removed that luxury and exposed a genuine cycle that had always been latent:\n *\n * - apps-manager seeds the application's database during provisioning;\n * - those rows need tables, which come from the application's OWN `migrations/` directory;\n * - those migrations are applied by the application backend at boot\n * (`applyStartupPostgresMigrations`, the production door);\n * - and the backend cannot boot until it is seeded, because its execution-context creator requires\n * exactly one APPLICATION row.\n *\n * Nothing inside that circle can break it. apps-manager cannot read the application's migration files\n * — in production they ship inside the application's own image — and the backend cannot supply the\n * seed, which is authored in `wildo.saas.config.ts`. Only the DEPLOY TOOLING holds both, which is why\n * this is a two-phase contract rather than a retry, a tolerance, or a longer timeout.\n *\n * Observed 2026-08-23 on the first PostgreSQL install: provisioning aborted with\n * `relation \"applications\" does not exist`, and `wildo local dev` failed. The same order holds on\n * every lane, so per-application PostgreSQL provisioning had never completed anywhere.\n *\n * ## Why a request field rather than an inferred tolerance\n *\n * Making apps-manager silently skip seeding when the schema happens to be absent would be a\n * fail-open: provisioning would report success having left the application unbootable, and the caller\n * would have no way to tell a deferred seed from a completed one. The caller states its intent, and\n * the response states what happened — see {@link AppDatabaseSeedingOutcome}.\n */\nexport enum AppDatabaseSeedingPhase {\n /**\n * Seed now. The default, and the ONLY behaviour any pre-2026-08-23 caller can produce, so every\n * MongoDB lane and every older CLI is unchanged.\n */\n REQUIRED = 'REQUIRED',\n /**\n * Provision infrastructure and platform records, but do NOT seed the application's own database —\n * the caller is about to create its schema and will then re-invoke with {@link REQUIRED}.\n */\n DEFERRED = 'DEFERRED',\n}\n\n/**\n * What provisioning actually DID about the application's own bootstrap rows.\n *\n * Reported so a caller can never mistake a deferred seed for a completed one. The CLI treats\n * {@link DEFERRED} as expected on its first phase and FATAL on its second — an application that is\n * still unseeded after its migrations have been applied is a defect, not a state to tolerate.\n */\nexport enum AppDatabaseSeedingOutcome {\n /** Bootstrap rows exist in the application's own database. */\n SEEDED = 'SEEDED',\n /** Skipped because the caller asked for {@link AppDatabaseSeedingPhase.DEFERRED}. */\n DEFERRED = 'DEFERRED',\n /**\n * Skipped because the application has no resolved persistence target. Distinct from\n * {@link DEFERRED}: nothing the caller does next will seed it — the target itself is missing.\n */\n NO_PERSISTENCE_TARGET = 'NO_PERSISTENCE_TARGET',\n}\n\nexport const AppBootstrapFirstAdminSeedSchema = z.object({\n userTypes: z.array(z.string().min(1)).min(1),\n});\n\nconst AppBootstrapRotatedPublicKeyEntrySchema = z.object({\n kid: z.string().min(1),\n publicKey: z.string().min(1),\n /** Last observation/token instant this retired key may authenticate. */\n notAfter: z.coerce.date().optional(),\n});\n\nexport interface AppBootstrapConfigMetadataResponse {\n appSlug: string;\n appIdentity?: AppConfiguration_Shared_AppIdentity;\n frontendServices?: FrontendServicesConfig;\n minions?: Record<string, {\n resourceAccess?: MinionResourceAccess;\n /** R4/R5 — what this minion may read about ITSELF at the platform level. Absent ⇒ nothing. */\n platformAccess?: MinionPlatformAccessCarried;\n /** KD-12 — `'cron'` minions paired with a `schedule` produce MINION_TICK CronJob records. */\n mode?: 'always-up' | 'cron';\n schedule?: string;\n }>;\n workers?: Record<string, {\n name: string;\n displayName: string;\n description?: string;\n runtime: {\n type: string;\n language: string;\n };\n http: {\n port: number;\n healthPath: string;\n readyPath: string;\n metricsPath?: string;\n };\n auth: 'wildo-jwt';\n replicas: number;\n resources?: {\n cpu?: string;\n memory?: string;\n };\n dataAccess?: {\n database?: 'read-only' | 'read-write' | 'none';\n cache?: boolean;\n queue?: 'consumer' | 'producer' | 'both' | 'none';\n };\n }>;\n engineCapabilities?: EngineCapabilityActivations;\n providers?: SaasConfigProvidersBlock;\n email?: {\n isTransactionalWildoManaged: boolean;\n isMarketingWildoManaged: boolean;\n };\n providerConfigurations: ProviderConfigurations;\n jwt?: {\n publicKey: Record<string, string>;\n rotatedPublicKeys?: Record<string, Array<z.infer<typeof AppBootstrapRotatedPublicKeyEntrySchema>>>;\n accessTokenExpirationMinutes: number;\n refreshTokenExpirationDays: number;\n };\n}\n\nexport const AppBootstrapConfigMetadataResponseSchema = z.object({\n appSlug: z.string().min(1),\n appIdentity: AppConfiguration_Shared_AppIdentity_Schema.optional(),\n frontendServices: FrontendServicesConfigSchema.optional(),\n minions: AdminAppManagedMinionsSchema.optional(),\n workers: AdminAppManagedWorkersSchema.optional(),\n engineCapabilities: EngineCapabilityActivationsSchema.optional(),\n providers: SaasConfigProvidersBlockSchema.optional(),\n email: z.object({\n isTransactionalWildoManaged: z.boolean(),\n isMarketingWildoManaged: z.boolean(),\n }).optional(),\n providerConfigurations: ProviderConfigurationsSchema,\n jwt: z.object({\n publicKey: z.record(z.string(), z.string()),\n rotatedPublicKeys: z.record(\n z.string(),\n z.array(AppBootstrapRotatedPublicKeyEntrySchema),\n ).optional(),\n /**\n * Operator-authored JWT TTLs (Slice 3.3 hardening, F-24 / closeout).\n *\n * Sourced from `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}` (which itself was seeded from\n * `serviceAuth` in `wildo.infra.<env>.config.ts` at apps-manager init\n * time, falling back to `WildoAuthConfigSchema` defaults of 15 min /\n * 30 days when omitted \\u2014 access-token default tightened from 60\n * \\u2192 15 in Auth-hardening Slice A Step 5 on 2026-04-13; see the\n * file-level JSDoc on `auth.schemas.ts` for the threat-model rationale).\n * The application backend MUST consume these values at sign time\n * (`AuthTokenIssuerBackendService.issueAccessToken`,\n * `JwtBackendService.createRefreshToken`) instead of falling back to\n * developer-authored constants in `saas-config.backend.ts`.\n *\n * REQUIRED on the response (Slice 3 closeout): `_getDefault_WildoApplicationConfig`\n * always seeds these via `WildoAuthConfigSchema.parse(serviceAuth ?? {})`\n * (15 min / 30 days defaults), so any persisted\n * `Wildo_Application_Config.jwt` block has both fields populated.\n * Marking them required here lets the consumer\n * (`app-configuration-loader.backend.service.ts`) drop the\n * `accessTokenExpirationMinutes !== undefined ? ... : {}` defensive\n * spread and treat them as guaranteed values.\n */\n accessTokenExpirationMinutes: z.number().int().positive(),\n refreshTokenExpirationDays: z.number().int().positive(),\n }).optional(),\n}) as z.ZodType<AppBootstrapConfigMetadataResponse>;\n\nexport interface AppWorkerBootstrapResponse {\n appSlug: string;\n workerName: string;\n worker: z.infer<typeof AdminAppManagedWorkersSchema>[string];\n jwt: {\n publicKey: string;\n rotatedPublicKeys?: Array<z.infer<typeof AppBootstrapRotatedPublicKeyEntrySchema>>;\n };\n}\n\nexport const AppWorkerBootstrapResponseSchema = z.object({\n appSlug: z.string().min(1),\n workerName: z.string().min(1),\n worker: z.object({\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().optional(),\n runtime: WorkerRuntimeSchema,\n http: WorkerHttpSchema,\n auth: WorkerAuthSchema,\n replicas: z.number().int().positive(),\n resources: ResourceLimitsSchema.optional(),\n dataAccess: DataAccessSchema.optional(),\n }),\n jwt: z.object({\n publicKey: z.string().min(1),\n rotatedPublicKeys: z.array(AppBootstrapRotatedPublicKeyEntrySchema).optional(),\n }),\n}) as z.ZodType<AppWorkerBootstrapResponse>;\n\ntype WildoAuthConfig = z.infer<typeof WildoAuthConfigSchema>;\n\nexport interface AdminAppInitializeRequest {\n name?: string;\n appDatabaseName?: string;\n override?: boolean;\n userEmail: string;\n userFirstName: string;\n userLastName: string;\n userPassword?: string;\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * The application's own persistence engine — see the field's JSDoc on the schema below for why it\n * exists at all.\n *\n * ⚠️ This interface and that schema are TWO declarations of ONE contract, joined by the\n * `as z.ZodType<AdminAppInitializeRequest>` cast. The cast means a field added to only the schema\n * type-checks perfectly while being invisible to every CONSUMER — which is exactly what happened on\n * 2026-08-19: apps-manager's controller could not read `applicationDatabase` off a parsed request\n * though the schema accepted it. Add to BOTH, always.\n */\n applicationDatabase?: { engine: DatabaseEngine; databaseName?: string };\n firstAdminSeed?: AppBootstrapFirstAdminSeed;\n /**\n * WHEN to seed this application's own database. Absent means\n * {@link AppDatabaseSeedingPhase.REQUIRED} — see that enum for why the phase is stated rather\n * than inferred.\n */\n appDatabaseSeeding?: AppDatabaseSeedingPhase;\n serviceAuth?: WildoAuthConfig;\n}\n\n/**\n * Shared admin request payload for a single app initialization.\n *\n * This describes the control-plane contract, independently of whether the\n * caller is the CLI or a future CI/CD executor.\n *\n * Required-by-contract fields:\n * - `managedDeclaration` — the projection of `wildo.saas.config.ts` that\n * seeds frontend services, capability policy, and external providers.\n * Omitting it would silently half-bootstrap an app, so the admin HTTP\n * boundary rejects requests without it.\n * - `userEmail` / `userFirstName` / `userLastName` — admin identity for\n * the seeded super-admin user. The previous implementation defaulted\n * these to a developer's personal identity, silently bypassing the\n * downstream `validateInitializationOptions` validation; that bypass\n * is now closed at the contract boundary.\n *\n * Optional-by-design fields:\n * - `userPassword` — the service auto-generates a secure password when\n * omitted (intentional one-shot bootstrap affordance).\n * - `name` / `appDatabaseName` / `override` / `firstAdminSeed` — caller\n * overrides; sensible defaults exist downstream.\n */\nexport const AdminAppInitializeRequestSchema = z.object({\n name: z.string().min(1).optional(),\n appDatabaseName: z.string().min(1).optional(),\n override: z.boolean().optional(),\n userEmail: z.email(),\n userFirstName: z.string().min(1),\n userLastName: z.string().min(1),\n userPassword: z.string().min(1).optional(),\n managedDeclaration: AdminAppManagedDeclarationSchema,\n /**\n * Which store this application's own resources persist to — mirrored from the authored\n * `applicationDatabase` in `wildo.infra.<env>.config.ts`, and carried under the SAME name so the\n * value is traceable end to end by one word.\n *\n * ## Why this field had to be added\n *\n * apps-manager already held the entire per-application PostgreSQL path: `mintAppCredentials`\n * provisioning the database, role and password, plus the `defaultAdapter` and `resourceIdFormat`\n * branches of the stored application config. All three were gated on\n * `WildoApplicationInitOptions.usePostgreSQL`, and on 2026-08-19 a repo-wide search found that flag\n * had FOUR mentions in the whole codebase — one declaration and three reads, in a single file.\n * **Nothing ever set it.**\n *\n * So the capability had no door. `backingServices.postgresql` had been authored for some time and\n * no application role ever appeared in `pg_roles`, because the declaration had no path to the\n * provisioner. This field is that path.\n *\n * OPTIONAL, and absence means MongoDB — matching\n * `ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER`'s own default, so an older CLI that does\n * not send it keeps exactly the behaviour every existing application already has.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n /**\n * The AUTHORED database name, from `backingServices.postgresql.database`.\n *\n * Sent because two sources were naming this database and disagreeing: the provisioner derives\n * `wildo_<sanitized-slug>` while `env-vars-builder` emits the authored name as\n * `POSTGRESQL_DATABASE`. On 2026-08-19 that produced `wildo_wonder_todos` (owned by the app role)\n * beside `wonder-todos-db` (what the backend was told to connect to) — both empty, so the\n * application would have opened a database it did not own while its grants landed elsewhere.\n *\n * The authored value wins: it is the git-borne declaration, it is what the env already carries,\n * and the provisioner has always accepted an override — the caller simply never passed one.\n */\n databaseName: z.string().min(1).optional(),\n }).optional(),\n firstAdminSeed: AppBootstrapFirstAdminSeedSchema.optional(),\n /**\n * WHEN to seed this application's own database — see {@link AppDatabaseSeedingPhase}.\n *\n * OPTIONAL, and absence means `REQUIRED`, so a CLI that predates the two-phase contract keeps\n * exactly the single-phase behaviour every MongoDB application already has.\n */\n appDatabaseSeeding: z.enum(AppDatabaseSeedingPhase).optional(),\n /**\n * Authored `serviceAuth` projection from `wildo.infra.<env>.config.ts`,\n * threaded by the CLI so apps-manager can seed\n * `Wildo_Application_Config.jwt.{accessTokenExpirationMinutes,\n * refreshTokenExpirationDays}` from the operator's policy instead of a\n * hardcoded constant. When omitted (older CLI, or infra file that does\n * not author `serviceAuth`), apps-manager applies the\n * `WildoAuthConfigSchema` defaults (15 min / 30 days as of Auth-hardening\n * Slice A Step 5 on 2026-04-13; pre-Slice-A the access-token default\n * was 60 min) at init time via `WildoAuthConfigSchema.parse({})`.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n}) as z.ZodType<AdminAppInitializeRequest>;\n\nexport interface AdminAppInitializeTarget {\n slug: string;\n name?: string;\n appDatabaseName?: string;\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * The application's own persistence engine — identical semantics to\n * {@link AdminAppInitializeRequest.applicationDatabase}, per target.\n *\n * Added 2026-08-27. The batch envelope had no way to express it, so\n * `POST /admin/apps/initialize` could only ever register applications as MongoDB — the single-app\n * endpoint carried the selection and its batch sibling silently dropped it. One invariant, two\n * call sites, applied at one (`.claude/rules/invariant-call-site-enumeration.md`).\n *\n * ⚠️ Interface AND schema, always — the `as z.ZodType<AdminAppInitializeTarget>` cast below makes\n * a schema-only addition type-check while staying invisible to every consumer.\n */\n applicationDatabase?: { engine: DatabaseEngine; databaseName?: string };\n firstAdminSeed?: AppBootstrapFirstAdminSeed;\n serviceAuth?: WildoAuthConfig;\n}\n\n/**\n * Per-target payload inside a batch admin initialization request.\n *\n * `managedDeclaration` is required for the same contract reason as in\n * `AdminAppInitializeRequestSchema`. Admin identity lives at the batch\n * envelope level (one admin user across all targets), not per target.\n */\nexport const AdminAppInitializeTargetSchema = z.object({\n slug: z.string().min(1),\n name: z.string().min(1).optional(),\n appDatabaseName: z.string().min(1).optional(),\n managedDeclaration: AdminAppManagedDeclarationSchema,\n /**\n * Per-target application persistence selection. Same shape and same meaning as\n * {@link AdminAppInitializeRequestSchema}'s field of this name — read that one for why the\n * selection must be authored rather than inferred from which backing services are declared.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n databaseName: z.string().min(1).optional(),\n }).optional(),\n firstAdminSeed: AppBootstrapFirstAdminSeedSchema.optional(),\n /**\n * Per-target `serviceAuth` projection. Today every target in a batch\n * shares the same infra-authored `serviceAuth` (one infra file per env),\n * but the field is per-target rather than batch-level so a future\n * targeted override (e.g. preview-app with a longer access TTL) can land\n * without breaking the contract. See\n * {@link AdminAppInitializeRequestSchema.serviceAuth} for full semantics.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n}) as z.ZodType<AdminAppInitializeTarget>;\n\nexport interface AdminAppsInitializeBatchRequest {\n override?: boolean;\n userEmail: string;\n userFirstName: string;\n userLastName: string;\n userPassword?: string;\n targets: AdminAppInitializeTarget[];\n}\n\n/**\n * Batch admin initialization envelope. Admin identity is required at the\n * envelope level (the seeded admin user is shared across all targets).\n */\nexport const AdminAppsInitializeBatchRequestSchema = z.object({\n override: z.boolean().optional(),\n userEmail: z.email(),\n userFirstName: z.string().min(1),\n userLastName: z.string().min(1),\n userPassword: z.string().min(1).optional(),\n targets: z.array(AdminAppInitializeTargetSchema).min(1),\n}) as z.ZodType<AdminAppsInitializeBatchRequest>;\n\nexport interface AdminAppReapplyDeclarationRequest {\n managedDeclaration: AdminAppManagedDeclaration;\n /**\n * Report what a reapply WOULD change and write nothing (issue #97).\n *\n * This is the comparison primitive behind every \"is the stored config still what the\n * application declares?\" question — the init postcondition and the `wildo local doctor`\n * drift check both ask it this way rather than each re-implementing an authored-vs-stored\n * differ. One comparison, one place it can be wrong.\n *\n * Optional and defaulting to a real reapply, so an existing caller keeps its behaviour: a flag\n * that silently turned writes into no-ops would be a far worse failure than the invisibility it\n * exists to cure.\n */\n dryRun?: boolean;\n}\n\n/**\n * Shared success response for a single app initialization request.\n */\nexport const AdminAppInitializeResponseSchema = z.object({\n success: z.literal(true),\n application: z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n }),\n credentials: z.object({\n email: z.email(),\n password: z.string().min(1),\n }),\n /**\n * What provisioning did about the application's own bootstrap rows — see\n * {@link AppDatabaseSeedingOutcome}.\n *\n * OPTIONAL so a CLI can still parse a response from an apps-manager that predates the two-phase\n * contract. A caller that DEPENDS on the two-phase flow must treat absence as \"unknown\" and say\n * so, never as `SEEDED`.\n */\n appDatabaseSeeding: z.enum(AppDatabaseSeedingOutcome).optional(),\n});\n\n/**\n * Shared admin request payload for reapplying the `wildo.saas.config.ts`\n * declaration projection (`AdminAppManagedDeclaration`) onto an\n * already-initialized application.\n *\n * Contract semantics — what this endpoint owns:\n * - Re-source the declaration-managed slices of `Wildo_Application_Config`\n * from the new declaration: `appIdentity` display fields,\n * `frontendServices` seed, `engineCapabilities`, `providers`, and\n * `providerConfigurations`.\n * - Return a `updatedFields` diff so the caller can surface what changed.\n *\n * Contract semantics — what this endpoint deliberately does NOT touch:\n * - Credentials (DB users, JWT private keys, session secrets, admin\n * passwords). Those live in `Wildo_Application_Secrets` and are owned\n * by initialize / rotate flows.\n * - Database / infrastructure provisioning. Those are owned by\n * `/admin/apps/:appSlug/initialize` and the platform-init flow.\n * - K8s endpoints. Those are owned by\n * `/admin/apps/:appSlug/refresh` (config refresh) and the deploy flow.\n * - First-admin seeding (`firstAdminSeed`). User/role seeding happens\n * at init time only. Reapplying the declaration is a config-drift\n * operation; silently changing seeded role grants would be a\n * security regression. Callers wanting to change admin user types\n * must use a dedicated admin-management endpoint (not this one).\n *\n * Stable action identifier: `apps.reapply-declaration` (see\n * {@link APPS_REAPPLY_DECLARATION_ACTION_ID} in `bootstrap.contracts.ts`).\n * The CI/CD admin rights workstream (Step 8) reuses this identifier in\n * its permission grid so this endpoint can be granted independently\n * from the broader `apps.initialize` action.\n */\nexport const AdminAppReapplyDeclarationRequestSchema = z.strictObject({\n managedDeclaration: AdminAppManagedDeclarationSchema,\n dryRun: z.boolean().optional(),\n}) as z.ZodType<AdminAppReapplyDeclarationRequest>;\n\n/**\n * Shared success response for a managed-declaration reapply request.\n *\n * `updatedFields` lists the dot-paths of the declaration-projection\n * slices that actually changed (e.g. `appIdentity.displayName`,\n * `frontendServices`, `engineCapabilities`, `providers`).\n * An empty list means the stored config already matched the new\n * declaration — the operation is idempotent.\n *\n * When `dryRun` is `true` the same list describes what WOULD change; nothing\n * was written. An empty `updatedFields` under `dryRun` is therefore a positive\n * coherence proof: the stored config matches the declaration right now.\n */\nexport const AdminAppReapplyDeclarationResponseSchema = z.object({\n success: z.literal(true),\n appSlug: z.string().min(1),\n updatedFields: z.array(z.string()),\n appliedAt: z.string().datetime(),\n /**\n * Whether this response describes a PREVIEW or an APPLIED change.\n *\n * REQUIRED rather than optional, and echoed from the request rather than assumed by the\n * caller: `updatedFields` reads identically in both modes, so `['providerConfigurations']`\n * means two opposite things depending on this flag. A caller that cannot tell them apart may\n * report \"reapplied\" for a run that changed nothing on the server. Issue #97 is what a\n * silently implicit answer to \"did this actually take?\" costs.\n */\n dryRun: z.boolean(),\n});\n\nexport type AppBootstrapCredentials = z.infer<typeof AppBootstrapCredentialsSchema>;\nexport type AppBootstrapCredentialsResponse = z.infer<typeof AppBootstrapCredentialsResponseSchema>;\nexport type AppBootstrapFirstAdminSeed = z.infer<typeof AppBootstrapFirstAdminSeedSchema>;\nexport type AdminAppInitializeResponse = z.infer<typeof AdminAppInitializeResponseSchema>;\nexport type AdminAppReapplyDeclarationResponse = z.infer<typeof AdminAppReapplyDeclarationResponseSchema>;\n"]}
@@ -58,7 +58,6 @@ export declare enum PlatformInfrastructureEnvKey {
58
58
  STORAGE_BUCKET = "STORAGE_BUCKET",
59
59
  STORAGE_ACCESS_KEY = "STORAGE_ACCESS_KEY",
60
60
  STORAGE_SECRET_KEY = "STORAGE_SECRET_KEY",
61
- GOTENBERG_URL = "GOTENBERG_URL",
62
61
  PG_HOST = "PG_HOST",
63
62
  PG_PORT = "PG_PORT",
64
63
  PG_ADMIN_USER = "PG_ADMIN_USER",
@@ -204,10 +203,10 @@ export declare enum PlatformObservabilityEnvKey {
204
203
  * carries a structured payload in one var). Read by
205
204
  * `ExternalProvidersRegistryBackendService` at capability-resolution time to
206
205
  * override the app-wide `providers.scopes.backend.selection[capability]`
207
- * primary/fallbacks for THIS environment only. Absent => the SaaS-config
206
+ * primary/substitutes for THIS environment only. Absent => the SaaS-config
208
207
  * selection applies unchanged.
209
208
  *
210
- * Shape: `{ "<EngineCapability>": { "primary": "<ref>", "fallbacks"?: ["<ref>"] } }`.
209
+ * Shape: `{ "<EngineCapability>": { "primary": "<ref>", "whenUnavailable"?: ["<ref>"] } }`.
211
210
  */
212
211
  export declare enum PlatformProviderSelectionEnvKey {
213
212
  WILDO_PROVIDER_SELECTION_OVERRIDES = "WILDO_PROVIDER_SELECTION_OVERRIDES"
@@ -1 +1 @@
1
- {"version":3,"file":"platform-runtime-env.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;CACxC;AAED,oBAAY,wBAAwB;IAClC,yBAAyB,8BAA8B;IACvD,qCAAqC,0CAA0C;IAC/E,4BAA4B,iCAAiC;CAC9D;AAED,oBAAY,4BAA4B;IACtC,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;IAC/C,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,oBAAoB,yBAAyB;IAC7C,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/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B;IACzD,iBAAiB,sBAAsB;IACvC,wBAAwB,6BAA6B;IACrD;;;;;;OAMG;IACH,6BAA6B,kCAAkC;IAC/D,8EAA8E;IAC9E,yBAAyB,8BAA8B;CACxD;AAED;;;;;;;;;;;;;GAaG;AACH,oBAAY,+BAA+B;IACzC,kCAAkC,uCAAuC;CAC1E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oBAAY,+BAA+B;IACzC,uBAAuB,4BAA4B;IACnD,kBAAkB,uBAAuB;IACzC,gCAAgC,qCAAqC;CACtE;AAED,eAAO,MAAM,gCAAgC,wCAAkC,CAAC;AAChF,eAAO,MAAM,sBAAsB,8BAAwB,CAAC;AAC5D,eAAO,MAAM,yBAAyB,iCAA2B,CAAC;AAClE,eAAO,MAAM,6BAA6B,qCAA+B,CAAC;AAC1E,eAAO,MAAM,uBAAuB,+BAAyB,CAAC;AAC9D,eAAO,MAAM,oBAAoB,4BAAsB,CAAC;AACxD,eAAO,MAAM,yBAAyB,iCAA2B,CAAC;AAClE,eAAO,MAAM,sBAAsB,8BAAwB,CAAC;AAC5D,eAAO,MAAM,sBAAsB,8BAAwB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,oCAA8B,CAAC;AACxE,eAAO,MAAM,gCAAgC,wCAAkC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU3E;AAED,eAAO,MAAM,mCAAmC,aAqB9C,CAAC"}
1
+ {"version":3,"file":"platform-runtime-env.contracts.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAY,qBAAqB;IAC/B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,eAAe,oBAAoB;IACnC,iBAAiB,sBAA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AAe,EAAE,MAAM,GAAG,MAAM,CAU3E;AAED,eAAO,MAAM,mCAAmC,aAqB9C,CAAC"}
@@ -61,7 +61,6 @@ export var PlatformInfrastructureEnvKey;
61
61
  PlatformInfrastructureEnvKey["STORAGE_BUCKET"] = "STORAGE_BUCKET";
62
62
  PlatformInfrastructureEnvKey["STORAGE_ACCESS_KEY"] = "STORAGE_ACCESS_KEY";
63
63
  PlatformInfrastructureEnvKey["STORAGE_SECRET_KEY"] = "STORAGE_SECRET_KEY";
64
- PlatformInfrastructureEnvKey["GOTENBERG_URL"] = "GOTENBERG_URL";
65
64
  PlatformInfrastructureEnvKey["PG_HOST"] = "PG_HOST";
66
65
  PlatformInfrastructureEnvKey["PG_PORT"] = "PG_PORT";
67
66
  PlatformInfrastructureEnvKey["PG_ADMIN_USER"] = "PG_ADMIN_USER";
@@ -213,10 +212,10 @@ export var PlatformObservabilityEnvKey;
213
212
  * carries a structured payload in one var). Read by
214
213
  * `ExternalProvidersRegistryBackendService` at capability-resolution time to
215
214
  * override the app-wide `providers.scopes.backend.selection[capability]`
216
- * primary/fallbacks for THIS environment only. Absent => the SaaS-config
215
+ * primary/substitutes for THIS environment only. Absent => the SaaS-config
217
216
  * selection applies unchanged.
218
217
  *
219
- * Shape: `{ "<EngineCapability>": { "primary": "<ref>", "fallbacks"?: ["<ref>"] } }`.
218
+ * Shape: `{ "<EngineCapability>": { "primary": "<ref>", "whenUnavailable"?: ["<ref>"] } }`.
220
219
  */
221
220
  export var PlatformProviderSelectionEnvKey;
222
221
  (function (PlatformProviderSelectionEnvKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,4EAAmD,C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,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,oBAAoB;IACjD,4BAA4B,CAAC,uBAAuB;IACpD,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,kBAAkB;IAC/C,4BAA4B,CAAC,iBAAiB;IAC9C,4BAA4B,CAAC,cAAc;IAC3C,sBAAsB,CAAC,iCAAiC;IACxD,sBAAsB,CAAC,gCAAgC;IACvD,sBAAsB,CAAC,6CAA6C;IACpE,sBAAsB,CAAC,4CAA4C;IACnE,sBAAsB,CAAC,mCAAmC;IAC1D,sBAAsB,CAAC,qBAAqB;IAC5C,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n GOTENBERG_URL = 'GOTENBERG_URL',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation; see `external-public-domain-rename.md`.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/fallbacks for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"fallbacks\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
1
+ {"version":3,"file":"platform-runtime-env.contracts.js","sourceRoot":"","sources":["../../../../src/bootstrap/platform-runtime-env.contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,4EAAmD,CAAA;IACnD,4DAAmC,CAAA;IACnC,gEAAuC,CAAA;AACzC,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AAED,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,mFAAuD,CAAA;IACvD,2GAA+E,CAAA;IAC/E,yFAA6D,CAAA;AAC/D,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AAED,MAAM,CAAN,IAAY,4BAmEX;AAnED,WAAY,4BAA4B;IACtC,uEAAuC,CAAA;IACvC,yEAAyC,CAAA;IACzC,+EAA+C,CAAA;IAC/C,yDAAyB,CAAA;I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,mBAAmB,CAAC,cAAc;IAClC,mBAAmB,CAAC,6BAA6B;IACjD,yFAAyF;IACzF,iGAAiG;IACjG,gGAAgG;IAChG,2BAA2B,CAAC,0BAA0B;CACvD,CAAC,CAAC","sourcesContent":["/**\n * Shared environment contract for platform runtime processes.\n *\n * This captures the canonical env-var vocabulary used by CLI-generated platform\n * `.env` material and by platform services such as apps-manager at runtime.\n * Keep these keys declarative and cross-executor: the contract owns names and\n * sensitivity classification, while writers/readers own behavior.\n */\n\nexport enum PlatformProcessEnvKey {\n HOST = 'HOST',\n PORT = 'PORT',\n SERVICE_NAME = 'SERVICE_NAME',\n PLATFORM_ENVIRONMENT_ID = 'PLATFORM_ENVIRONMENT_ID',\n APPLICATION_ENV = 'APPLICATION_ENV',\n APPS_MANAGER_MODE = 'APPS_MANAGER_MODE',\n}\n\nexport enum PlatformServiceUrlEnvKey {\n PLATFORM_APPS_MANAGER_URL = 'PLATFORM_APPS_MANAGER_URL',\n PLATFORM_CRONTABS_BATCHES_MANAGER_URL = 'PLATFORM_CRONTABS_BATCHES_MANAGER_URL',\n PLATFORM_MODULE_REGISTRY_URL = 'PLATFORM_MODULE_REGISTRY_URL',\n}\n\nexport enum PlatformInfrastructureEnvKey {\n MONGO_CONNECT_URL = 'MONGO_CONNECT_URL',\n MONGO_PLATFORM_URL = 'MONGO_PLATFORM_URL',\n BASE_MONGO_SERVER_URL = 'BASE_MONGO_SERVER_URL',\n REDIS_HOST = 'REDIS_HOST',\n REDIS_PORT = 'REDIS_PORT',\n /**\n * Optional Redis logical database index (0–15). Emitted only when the\n * author sets `backingServices.redis.database` in `wildo.infra.<env>.config.ts`.\n * Consumers default to DB 0 when this var is missing.\n */\n REDIS_DATABASE = 'REDIS_DATABASE',\n REDIS_ADMIN_USER = 'REDIS_ADMIN_USER',\n REDIS_ADMIN_PASSWORD = 'REDIS_ADMIN_PASSWORD',\n RABBITMQ_HOST = 'RABBITMQ_HOST',\n RABBITMQ_PORT = 'RABBITMQ_PORT',\n RABBITMQ_MANAGEMENT_PORT = 'RABBITMQ_MANAGEMENT_PORT',\n /**\n * Optional RabbitMQ virtual host. Emitted only when the author sets\n * `backingServices.rabbitmq.vhost` in `wildo.infra.<env>.config.ts`.\n * Consumers default to `/` (the RabbitMQ root vhost) when missing.\n */\n RABBITMQ_VHOST = 'RABBITMQ_VHOST',\n RABBITMQ_ADMIN_USERNAME = 'RABBITMQ_ADMIN_USERNAME',\n RABBITMQ_ADMIN_PASSWORD = 'RABBITMQ_ADMIN_PASSWORD',\n STORAGE_PROVIDER = 'STORAGE_PROVIDER',\n /**\n * S3-compatible endpoint **hostname** (NOT a URL); see the matching\n * JSDoc on `ApplicationBackendDataEnvKey.STORAGE_ENDPOINT` for the\n * full contract (Slice 3.2 audit L-4). Kept here for the\n * platform-runtime side (apps-manager) — same\n * host:port-only invariant.\n */\n STORAGE_ENDPOINT = 'STORAGE_ENDPOINT',\n STORAGE_PORT = 'STORAGE_PORT',\n STORAGE_USE_SSL = 'STORAGE_USE_SSL',\n STORAGE_BUCKET = 'STORAGE_BUCKET',\n STORAGE_ACCESS_KEY = 'STORAGE_ACCESS_KEY',\n STORAGE_SECRET_KEY = 'STORAGE_SECRET_KEY',\n PG_HOST = 'PG_HOST',\n PG_PORT = 'PG_PORT',\n PG_ADMIN_USER = 'PG_ADMIN_USER',\n PG_ADMIN_PASSWORD = 'PG_ADMIN_PASSWORD',\n /**\n * The MAINTENANCE database the admin pool connects to in order to provision others — NOT the\n * application's database and NOT the container's initdb database (that is\n * `POSTGRES_ADMIN_DATABASE`, a different key on a different transport). Emitted from\n * `PLATFORM_POSTGRES_MAINTENANCE_DATABASE`, whose JSDoc carries the three-way distinction and\n * the silent outage that conflating the first two produced.\n */\n PG_ADMIN_DATABASE = 'PG_ADMIN_DATABASE',\n PG_SSL_MODE = 'PG_SSL_MODE',\n /**\n * The platform's OWN PostgreSQL database — a full connection URL, the exact mirror of\n * `MONGO_CONNECT_URL` for a PostgreSQL-engined platform (D7 of the incremental-migrations plan).\n *\n * Distinct from the `PG_ADMIN_*` family above, which is PROVISIONING material (the admin\n * connection apps-manager uses to create per-application databases/roles). This key is the\n * database apps-manager's own resources live in. One URL rather than an address/credential\n * split on purpose: the platform pre-connects from env BEFORE any config document can be read\n * (the same chicken-and-egg `MONGO_CONNECT_URL` solves — the config documents live in the very\n * database this key addresses), so the whole answer must arrive in one env-delivered value.\n *\n * Emitted by the CLI's platform env builder only when the environment's\n * `database.engine === POSTGRESQL`. Absent on a Mongo-engined platform.\n */\n PG_CONNECT_URL = 'PG_CONNECT_URL',\n}\n\nexport enum PlatformSecurityEnvKey {\n PLATFORM_APPS_MANAGER_PRIVATE_KEY = 'PLATFORM_APPS_MANAGER_PRIVATE_KEY',\n PLATFORM_APPS_MANAGER_PUBLIC_KEY = 'PLATFORM_APPS_MANAGER_PUBLIC_KEY',\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair. The design is\n * per-service (mirrors apps-manager): the crontabs scheduler signs each SCHEDULED_CRON /\n * MINION_TICK job token with the PRIVATE half, and every app + minion verifies it against\n * the PUBLIC half (distributed to each app's `PLATFORM_CRONTABS_BATCHES_MANAGER` verify\n * slot by apps-manager). These were previously absent from the whole minting/emission\n * chain — so crontabs silently fell back to another key and apps handed out an EMPTY verify\n * key, dead-lettering every scheduled tick. Minted by `buildCredentials`, emitted here.\n */\n PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY',\n PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY = 'PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY',\n PLATFORM_APPLICATION_PRIMARY_SECRET = 'PLATFORM_APPLICATION_PRIMARY_SECRET',\n PLATFORM_ADMIN_SECRET = 'PLATFORM_ADMIN_SECRET',\n}\n\nexport enum PlatformAdminEnvKey {\n ADMIN_EMAIL = 'ADMIN_EMAIL',\n ADMIN_PASSWORD = 'ADMIN_PASSWORD',\n ADMIN_FIRST_NAME = 'ADMIN_FIRST_NAME',\n ADMIN_LAST_NAME = 'ADMIN_LAST_NAME',\n GITHUB_WILDO_APPS_DEFAULT_ORG_URL = 'GITHUB_WILDO_APPS_DEFAULT_ORG_URL',\n GITHUB_WILDO_APPS_ADMIN_USER = 'GITHUB_WILDO_APPS_ADMIN_USER',\n GITHUB_WILDO_APPS_ADMIN_TOKEN = 'GITHUB_WILDO_APPS_ADMIN_TOKEN',\n}\n\nexport enum PlatformKubernetesEnvKey {\n K8S_NAMESPACE = 'K8S_NAMESPACE',\n}\n\n/**\n * Ingress / reverse-proxy env keys.\n *\n * `WILDO_PUBLIC_DOMAIN` is the runtime-agnostic public hostname that\n * apps-manager uses to compose ingress URLs and that backend services\n * use to derive cookie `Domain` and CORS allowlist entries. It applies\n * to BOTH Kubernetes and Docker Compose deployments — naming it\n * `K8S_*` (as in the previous `K8S_EXTERNAL_BASE_DOMAIN`) was a\n * conflation; see `external-public-domain-rename.md`.\n */\nexport enum PlatformIngressEnvKey {\n WILDO_PUBLIC_DOMAIN = 'WILDO_PUBLIC_DOMAIN',\n /**\n * JSON-serialized `WildoInfraEnvConfig.serviceHosts` map (`<serviceKey> →\n * subdomain chain`, `''` = apex). Projected by `env-vars-builder` so\n * apps-manager can resolve each customer-app service's public host via\n * `buildServicePublicHost` (serviceHosts-driven ingress, no fan-out). Absent\n * / empty ⇒ every key falls back to `<serviceKey>.<publicDomain>`.\n */\n WILDO_SERVICE_HOSTS = 'WILDO_SERVICE_HOSTS',\n}\n\n/**\n * Logging env-var contract (Slice 3.5).\n *\n * Both keys are projected from `WildoInfraEnvConfig.logging.*` by\n * `env-vars-builder` for every long-running platform/application\n * process, and consumed by `LoggerService.loadConfiguration` in\n * `saas-backend-lib`. Missing values fall back to the LoggerService\n * defaults (level `debug`, pino-pretty auto-detect by environment),\n * matching the optional shape on `WildoLoggingConfigSchema`.\n *\n * `LOG_LEVEL` accepts the lowercase pino levels\n * (`debug | info | warn | error`); the `WildoLoggingConfigSchema` enum\n * is the authoritative validation surface upstream so an invalid\n * value can never reach `process.env`.\n *\n * `LOG_FORMATTED_CONSOLE_ERRORS` is a stringified boolean\n * (`'true' | 'false'`) that overrides the LoggerService's\n * environment-derived pino-pretty / JSON branch. When unset,\n * LoggerService keeps its existing auto-detect behavior (pino-pretty\n * iff `APPLICATION_ENV === 'development'`).\n */\nexport enum PlatformLoggingEnvKey {\n LOG_LEVEL = 'LOG_LEVEL',\n LOG_FORMATTED_CONSOLE_ERRORS = 'LOG_FORMATTED_CONSOLE_ERRORS',\n}\n\n/**\n * OTLP telemetry env-var contract (Slice 2 Phase 5).\n *\n * Projected from `WildoInfraEnvConfig.observability.*` + the selected\n * `OBSERVABILITY_TELEMETRY` provider by `env-vars-builder`, and read by the\n * `otel-preload.ts` OTel SDK in `saas-backend-lib` BEFORE app code. These are the\n * STANDARD OpenTelemetry env vars — the preload + OTLP exporters consume them\n * directly, so the engine stays provider-agnostic.\n *\n * `OTEL_ENABLED` is the master gate (`'true'`). `OTEL_EXPORTER_OTLP_ENDPOINT` is the\n * OTLP/HTTP collector/ingest URL. `OTEL_EXPORTER_OTLP_HEADERS` carries the provider auth\n * (e.g. `Authorization=Bearer <source-token>`) — SENSITIVE, routed to the K8s Secret.\n * `OTEL_SERVICE_NAME` + `OTEL_RESOURCE_ATTRIBUTES` carry the resource identity\n * (`service.name`, `service.version`, `deployment.environment`).\n */\nexport enum PlatformObservabilityEnvKey {\n OTEL_ENABLED = 'OTEL_ENABLED',\n OTEL_EXPORTER_OTLP_ENDPOINT = 'OTEL_EXPORTER_OTLP_ENDPOINT',\n OTEL_EXPORTER_OTLP_HEADERS = 'OTEL_EXPORTER_OTLP_HEADERS',\n OTEL_SERVICE_NAME = 'OTEL_SERVICE_NAME',\n OTEL_RESOURCE_ATTRIBUTES = 'OTEL_RESOURCE_ATTRIBUTES',\n /**\n * LLM-call observability (a SEPARATE signal from OTLP telemetry — PostHog\n * `$ai_generation` via the engine's `AgentCallTraceSink`): opt-in forwarding\n * of prompt + completion content (`$ai_input` / `$ai_output_choices`). PII\n * shipped to a third party, hence opt-in per environment. Read by the\n * engine's lazy LLM-obs sink resolution, NOT the OTLP preload.\n */\n WILDO_LLM_OBS_CAPTURE_CONTENT = 'WILDO_LLM_OBS_CAPTURE_CONTENT',\n /** LLM-call observability sampling fraction (0..1); omitted = capture all. */\n WILDO_LLM_OBS_SAMPLE_RATE = 'WILDO_LLM_OBS_SAMPLE_RATE',\n}\n\n/**\n * Per-environment external-provider SELECTION override env-var contract\n * (2026-07-10).\n *\n * Projected from `WildoInfraEnvConfig.providerSelection` by `env-vars-builder`\n * as a single serialized JSON payload (mirrors how `APPLICATION_RUNTIME_ENDPOINTS`\n * carries a structured payload in one var). Read by\n * `ExternalProvidersRegistryBackendService` at capability-resolution time to\n * override the app-wide `providers.scopes.backend.selection[capability]`\n * primary/substitutes for THIS environment only. Absent => the SaaS-config\n * selection applies unchanged.\n *\n * Shape: `{ \"<EngineCapability>\": { \"primary\": \"<ref>\", \"whenUnavailable\"?: [\"<ref>\"] } }`.\n */\nexport enum PlatformProviderSelectionEnvKey {\n WILDO_PROVIDER_SELECTION_OVERRIDES = 'WILDO_PROVIDER_SELECTION_OVERRIDES',\n}\n\n/**\n * Documentation-site BUILD env-var contract.\n *\n * Projected from `WildoInfraEnvConfig.documentationSite` by `env-vars-builder`. Unlike the\n * other families here these are consumed by a BUILD rather than a running service: a\n * Docusaurus bundle compiles its origins in, so the values must be present when the site is\n * built, and a bundle built with the wrong ones silently points every reader at the wrong\n * host instead of failing.\n *\n * The application's `docusaurus.config.ts` refuses to complete a production build when they\n * are unset, and falls back to local defaults otherwise. Before this contract existed the\n * only way to satisfy that guard was to remember three variables on a build command line,\n * so they appeared in no environment definition anywhere.\n *\n * Emitted individually rather than as one serialized payload (the `providerSelection`\n * shape): each is a single scalar read directly by the config, and a JSON blob would force\n * the docs config to parse a payload to recover three strings.\n */\nexport enum PlatformDocumentationSiteEnvKey {\n WILDO_DOCS_API_BASE_URL = 'WILDO_DOCS_API_BASE_URL',\n WILDO_DOCS_APP_URL = 'WILDO_DOCS_APP_URL',\n WILDO_DOCS_FRONTEND_SERVICE_NAME = 'WILDO_DOCS_FRONTEND_SERVICE_NAME',\n}\n\nexport const PlatformDocumentationSiteEnvKeys = PlatformDocumentationSiteEnvKey;\nexport const PlatformProcessEnvKeys = PlatformProcessEnvKey;\nexport const PlatformServiceUrlEnvKeys = PlatformServiceUrlEnvKey;\nexport const PlatformInfrastructureEnvKeys = PlatformInfrastructureEnvKey;\nexport const PlatformSecurityEnvKeys = PlatformSecurityEnvKey;\nexport const PlatformAdminEnvKeys = PlatformAdminEnvKey;\nexport const PlatformKubernetesEnvKeys = PlatformKubernetesEnvKey;\nexport const PlatformIngressEnvKeys = PlatformIngressEnvKey;\nexport const PlatformLoggingEnvKeys = PlatformLoggingEnvKey;\nexport const PlatformObservabilityEnvKeys = PlatformObservabilityEnvKey;\nexport const PlatformProviderSelectionEnvKeys = PlatformProviderSelectionEnvKey;\n\n/**\n * Resolve a required environment variable value or throw a clear,\n * actionable error.\n *\n * This is the canonical fail-closed reader for platform runtime env vars.\n * It exists to replace silent string-fallback patterns like\n * `process.env.X || 'localhost'` / `process.env.Y || 'local'` /\n * `process.env.Z || 'http://localhost:NNNN'` in apps-manager and any\n * other platform service. Those patterns let production processes start\n * silently mis-wired (e.g. talking to `localhost` instead of the real\n * cluster service) and surface as opaque downstream errors much later.\n *\n * Contract:\n * - Empty strings are treated as missing (a `KEY=` line in `.env` is a\n * misconfiguration, not an \"intentional empty value\").\n * - The thrown error names both the env var and the consuming context\n * (e.g. `\"Missing required env var REDIS_HOST (consumer:\n * PlatformInfrastructureManagerService.provisionAllPlatformConfigs)\"`).\n * - This helper does NOT decide whether a key is sensitive — that lives\n * in `PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS`. Callers are responsible\n * for not logging the resolved value when sensitive.\n *\n * Usage:\n * const host = requireEnv(\n * PlatformInfrastructureEnvKey.REDIS_HOST,\n * 'PlatformInfrastructureManagerService.provisionAllPlatformConfigs',\n * );\n *\n * Local-development defaults must live in `secrets.json` /\n * `infrastructure/<env>/secrets/` and be loaded into `process.env` by\n * the CLI / K8s wiring, NOT in production code paths.\n */\nexport function requireEnv(envName: string, consumerContext: string): string {\n const raw = process.env[envName];\n if (raw === undefined || raw === '') {\n throw new Error(\n `Missing required environment variable ${envName} (consumer: ${consumerContext}). ` +\n `Local development defaults belong in secrets.json / infrastructure/<env>/secrets/, ` +\n `not in production code fallbacks.`,\n );\n }\n return raw;\n}\n\nexport const PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS = new Set<string>([\n PlatformInfrastructureEnvKey.MONGO_CONNECT_URL,\n PlatformInfrastructureEnvKey.MONGO_PLATFORM_URL,\n PlatformInfrastructureEnvKey.REDIS_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.RABBITMQ_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.STORAGE_ACCESS_KEY,\n PlatformInfrastructureEnvKey.STORAGE_SECRET_KEY,\n PlatformInfrastructureEnvKey.PG_ADMIN_PASSWORD,\n PlatformInfrastructureEnvKey.PG_CONNECT_URL,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPS_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY,\n PlatformSecurityEnvKey.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY,\n PlatformSecurityEnvKey.PLATFORM_APPLICATION_PRIMARY_SECRET,\n PlatformSecurityEnvKey.PLATFORM_ADMIN_SECRET,\n PlatformAdminEnvKey.ADMIN_PASSWORD,\n PlatformAdminEnvKey.GITHUB_WILDO_APPS_ADMIN_TOKEN,\n // OTLP auth header carries the provider source token (e.g. a BetterStack Bearer token) →\n // secret (K8s Secret, docker env_file). The sibling OTEL_ENABLED / OTEL_EXPORTER_OTLP_ENDPOINT /\n // OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES are non-secret config and deliberately stay out.\n PlatformObservabilityEnvKey.OTEL_EXPORTER_OTLP_HEADERS,\n]);\n"]}
@@ -27,7 +27,6 @@ export declare enum WildoRuntimeNetwork {
27
27
  DATA_RABBIT = "wildo-data-rabbit",
28
28
  DATA_OBJECTS = "wildo-data-objects",
29
29
  DATA_ANTIVIRUS = "wildo-data-antivirus",
30
- DATA_RENDERING = "wildo-data-rendering",
31
30
  /** Tamper-evident audit-log storage (immudb) — a service of its own, not a database table. */
32
31
  DATA_AUDIT = "wildo-data-audit",
33
32
  /** The OTel collector. Nearly every runtime emits to it; almost nothing reads from it. */
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-network-topology.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-network-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,oBAAY,mBAAmB;IAC7B,sFAAsF;IACtF,IAAI,eAAe;IACnB;;;;OAIG;IACH,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,aAAa,wBAAwB;IACrC,UAAU,qBAAqB;IAC/B,WAAW,sBAAsB;IACjC,YAAY,uBAAuB;IACnC,cAAc,yBAAyB;IACvC,cAAc,yBAAyB;IACvC,8FAA8F;IAC9F,UAAU,qBAAqB;IAC/B,0FAA0F;IAC1F,cAAc,yBAAyB;IACvC;;;;;OAKG;IACH,MAAM,iBAAiB;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAyBtF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,WAAW,CAAC,mBAAmB,CAAC,CAgClC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAEvE"}
1
+ {"version":3,"file":"runtime-network-topology.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-network-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,oBAAY,mBAAmB;IAC7B,sFAAsF;IACtF,IAAI,eAAe;IACnB;;;;OAIG;IACH,QAAQ,mBAAmB;IAC3B,UAAU,qBAAqB;IAC/B,aAAa,wBAAwB;IACrC,UAAU,qBAAqB;IAC/B,WAAW,sBAAsB;IACjC,YAAY,uBAAuB;IACnC,cAAc,yBAAyB;IACvC,8FAA8F;IAC9F,UAAU,qBAAqB;IAC/B,0FAA0F;IAC1F,cAAc,yBAAyB;IACvC;;;;;OAKG;IACH,MAAM,iBAAiB;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAwBtF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,2BAA2B,GAAG,SAAS,EAClD,WAAW,CAAC,EAAE,wBAAwB,GAAG,SAAS,EAClD,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,WAAW,CAAC,mBAAmB,CAAC,CAgClC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAEvE"}
@@ -27,7 +27,6 @@ export var WildoRuntimeNetwork;
27
27
  WildoRuntimeNetwork["DATA_RABBIT"] = "wildo-data-rabbit";
28
28
  WildoRuntimeNetwork["DATA_OBJECTS"] = "wildo-data-objects";
29
29
  WildoRuntimeNetwork["DATA_ANTIVIRUS"] = "wildo-data-antivirus";
30
- WildoRuntimeNetwork["DATA_RENDERING"] = "wildo-data-rendering";
31
30
  /** Tamper-evident audit-log storage (immudb) — a service of its own, not a database table. */
32
31
  WildoRuntimeNetwork["DATA_AUDIT"] = "wildo-data-audit";
33
32
  /** The OTel collector. Nearly every runtime emits to it; almost nothing reads from it. */
@@ -56,7 +55,6 @@ export const NETWORK_FOR_CAPABILITY = {
56
55
  [InfraCapability.QUEUING_SYSTEM]: WildoRuntimeNetwork.DATA_RABBIT,
57
56
  [InfraCapability.OBJECT_STORAGE]: WildoRuntimeNetwork.DATA_OBJECTS,
58
57
  [InfraCapability.ANTIVIRUS_SCANNING]: WildoRuntimeNetwork.DATA_ANTIVIRUS,
59
- [InfraCapability.DOCUMENT_RENDERING]: WildoRuntimeNetwork.DATA_RENDERING,
60
58
  // ⚠️ CORRECTED 2026-08-12. Both of the entries below were `null`, on reasoning
61
59
  // that measurement disproved while building the 5B service table:
62
60
  //
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-network-topology.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-network-topology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EACL,kCAAkC,GAEnC,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,mBA2BX;AA3BD,WAAY,mBAAmB;IAC7B,sFAA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al } from './runtime-principal.contracts';\nimport {\n resolveRuntimeBackingServiceAccess,\n type RuntimeAccessDeclaration,\n} from './runtime-backing-service-access';\n\n/**\n * The network segments a Wildo deployment is divided into (Step 5-egress).\n *\n * Docker Compose has no `NetworkPolicy` object, but it has the mechanism that\n * matters for the destination half: membership of user-defined bridge networks,\n * with per-network embedded DNS. A container not attached to a network can\n * neither resolve nor route to the services on it — deny-by-default at the\n * network level. Kubernetes expresses the same division as `NetworkPolicy`\n * egress rules. Both renderers derive from THIS enum so they cannot describe\n * different topologies.\n */\nexport enum WildoRuntimeNetwork {\n /** Reverse proxy + every container serving HTTP. Not internal: it faces the world. */\n EDGE = 'wildo-edge',\n /**\n * The control plane — apps-manager, module-registry, crontabs — plus every\n * runtime that must fetch its secrets and configuration. Internal: nothing here\n * needs a route off the host.\n */\n PLATFORM = 'wildo-platform',\n DATA_MONGO = 'wildo-data-mongo',\n DATA_POSTGRES = 'wildo-data-postgres',\n DATA_REDIS = 'wildo-data-redis',\n DATA_RABBIT = 'wildo-data-rabbit',\n DATA_OBJECTS = 'wildo-data-objects',\n DATA_ANTIVIRUS = 'wildo-data-antivirus',\n DATA_RENDERING = 'wildo-data-rendering',\n /** Tamper-evident audit-log storage (immudb) — a service of its own, not a database table. */\n DATA_AUDIT = 'wildo-data-audit',\n /** The OTel collector. Nearly every runtime emits to it; almost nothing reads from it. */\n DATA_TELEMETRY = 'wildo-data-telemetry',\n /**\n * The ONLY non-internal network below the edge. Attachment to any non-internal\n * network restores NAT, so \"can this runtime reach the internet?\" is decided\n * here and nowhere else — marking the data networks internal is necessary but\n * not sufficient.\n */\n EGRESS = 'wildo-egress',\n}\n\n/**\n * Which network serves each backing-service capability.\n *\n * A total `Record`, deliberately: adding a member to {@link InfraCapability}\n * becomes a COMPILE ERROR here rather than a capability that silently reaches no\n * network — or worse, one whose runtimes silently keep the flat-network\n * reachability this segmentation exists to remove. `null` means the capability\n * needs no network of its own, and every `null` states why.\n */\nexport const NETWORK_FOR_CAPABILITY: Record<InfraCapability, WildoRuntimeNetwork | null> = {\n [InfraCapability.DOCUMENT_DATABASE]: WildoRuntimeNetwork.DATA_MONGO,\n [InfraCapability.RELATIONAL_DATABASE]: WildoRuntimeNetwork.DATA_POSTGRES,\n [InfraCapability.CACHE_MANAGER]: WildoRuntimeNetwork.DATA_REDIS,\n [InfraCapability.QUEUING_SYSTEM]: WildoRuntimeNetwork.DATA_RABBIT,\n [InfraCapability.OBJECT_STORAGE]: WildoRuntimeNetwork.DATA_OBJECTS,\n [InfraCapability.ANTIVIRUS_SCANNING]: WildoRuntimeNetwork.DATA_ANTIVIRUS,\n [InfraCapability.DOCUMENT_RENDERING]: WildoRuntimeNetwork.DATA_RENDERING,\n // ⚠️ CORRECTED 2026-08-12. Both of the entries below were `null`, on reasoning\n // that measurement disproved while building the 5B service table:\n //\n // - AUDIT_LOG_STORAGE was \"served BY the document/relational database\". It is\n // not: `immudb` is a service of its own, with its own container, and a\n // runtime that writes audit records dials IT rather than a database table.\n // - METRICS_TELEMETRY was \"no application runtime dials them directly today\".\n // Also false — runtimes emit spans and metrics to the collector, and that\n // traffic is live in development. A `null` here would have cut tracing for\n // every runtime the moment segmentation was enforced, with NO readiness\n // check covering it: a first-use failure, silent until someone noticed spans\n // had stopped.\n [InfraCapability.AUDIT_LOG_STORAGE]: WildoRuntimeNetwork.DATA_AUDIT,\n [InfraCapability.METRICS_TELEMETRY]: WildoRuntimeNetwork.DATA_TELEMETRY,\n // Backup remains genuinely operator-side: no application runtime dials it, and\n // the backup tooling runs outside the application's network entirely.\n [InfraCapability.BACKUP_MANAGER]: null,\n};\n\n/**\n * The networks a runtime's container joins.\n *\n * Derived from the SAME declaration as its credentials and its environment\n * topology — see {@link resolveRuntimeBackingServiceAccess}. That is the whole\n * point: a runtime kept off a service's network must also not hold that service's\n * credential nor receive its connect URL, and the only way three enforcement\n * points stay in agreement is by not deriving the answer three times.\n *\n * `PLATFORM` is unconditional. Every runtime — including a worker, which holds no\n * backing-service credentials at all — must reach apps-manager to fetch its own\n * bootstrap material. Withholding it would strand every runtime at boot, and it\n * grants no application data.\n */\nexport function resolveRuntimeNetworkMembership(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration?: RuntimeAccessDeclaration | undefined,\n options?: { readonly servesHttp?: boolean },\n): ReadonlySet<WildoRuntimeNetwork> {\n const access = resolveRuntimeBackingServiceAccess(principal, declaration);\n const networks = new Set<WildoRuntimeNetwork>();\n\n // PLATFORM is for runtimes that FETCH their own bootstrap material — every\n // runtime principal does, including a worker that holds no backing-service\n // credentials at all. A caller with NO principal is not a runtime principal:\n // today that is the static frontend, an nginx container that authenticates to\n // nothing and has no bootstrap material to fetch.\n //\n // This was previously unconditional, which put that frontend on the platform\n // segment. Harmless — the segment carries no application data and the container\n // could not authenticate anyway — but it is reachability nobody asked for, and\n // \"unconditional because every case so far needed it\" is exactly the default a\n // later reader assumes was measured.\n if (principal) networks.add(WildoRuntimeNetwork.PLATFORM);\n\n for (const capability of access.capabilities) {\n const network = NETWORK_FOR_CAPABILITY[capability];\n if (network) networks.add(network);\n }\n\n // Serving HTTP is a property of the DEPLOYMENT (does a proxy route to it?),\n // not of what the runtime declared, so it arrives separately rather than being\n // inferred from the principal kind — an application backend that serves no\n // public route should not be on the edge merely for being a backend.\n if (options?.servesHttp) networks.add(WildoRuntimeNetwork.EDGE);\n\n // Authored, never inferred. See `RuntimeBackingServiceAccess`.\n if (access.requiresInternetEgress) networks.add(WildoRuntimeNetwork.EGRESS);\n\n return networks;\n}\n\n/**\n * Networks that must be declared `internal: true`.\n *\n * Derived by EXCLUSION from the two that legitimately carry a route off the host,\n * so a network added to the enum is internal by default. The safe posture is the\n * one you get by not thinking about it.\n */\nexport function isInternalNetwork(network: WildoRuntimeNetwork): boolean {\n return network !== WildoRuntimeNetwork.EDGE && network !== WildoRuntimeNetwork.EGRESS;\n}\n"]}
1
+ {"version":3,"file":"runtime-network-topology.js","sourceRoot":"","sources":["../../../../src/bootstrap/runtime-network-topology.ts"],"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I,OAAO,KAAK,mBAAmB,CAAC,MAAM,CAAC;AACxF,CAAC","sourcesContent":["import { InfraCapability } from '../project-config/shared/infra-providers.schemas';\nimport type { ApplicationRuntimePrincipal } from './runtime-principal.contracts';\nimport {\n resolveRuntimeBackingServiceAccess,\n type RuntimeAccessDeclaration,\n} from './runtime-backing-service-access';\n\n/**\n * The network segments a Wildo deployment is divided into (Step 5-egress).\n *\n * Docker Compose has no `NetworkPolicy` object, but it has the mechanism that\n * matters for the destination half: membership of user-defined bridge networks,\n * with per-network embedded DNS. A container not attached to a network can\n * neither resolve nor route to the services on it — deny-by-default at the\n * network level. Kubernetes expresses the same division as `NetworkPolicy`\n * egress rules. Both renderers derive from THIS enum so they cannot describe\n * different topologies.\n */\nexport enum WildoRuntimeNetwork {\n /** Reverse proxy + every container serving HTTP. Not internal: it faces the world. */\n EDGE = 'wildo-edge',\n /**\n * The control plane — apps-manager, module-registry, crontabs — plus every\n * runtime that must fetch its secrets and configuration. Internal: nothing here\n * needs a route off the host.\n */\n PLATFORM = 'wildo-platform',\n DATA_MONGO = 'wildo-data-mongo',\n DATA_POSTGRES = 'wildo-data-postgres',\n DATA_REDIS = 'wildo-data-redis',\n DATA_RABBIT = 'wildo-data-rabbit',\n DATA_OBJECTS = 'wildo-data-objects',\n DATA_ANTIVIRUS = 'wildo-data-antivirus',\n /** Tamper-evident audit-log storage (immudb) — a service of its own, not a database table. */\n DATA_AUDIT = 'wildo-data-audit',\n /** The OTel collector. Nearly every runtime emits to it; almost nothing reads from it. */\n DATA_TELEMETRY = 'wildo-data-telemetry',\n /**\n * The ONLY non-internal network below the edge. Attachment to any non-internal\n * network restores NAT, so \"can this runtime reach the internet?\" is decided\n * here and nowhere else — marking the data networks internal is necessary but\n * not sufficient.\n */\n EGRESS = 'wildo-egress',\n}\n\n/**\n * Which network serves each backing-service capability.\n *\n * A total `Record`, deliberately: adding a member to {@link InfraCapability}\n * becomes a COMPILE ERROR here rather than a capability that silently reaches no\n * network — or worse, one whose runtimes silently keep the flat-network\n * reachability this segmentation exists to remove. `null` means the capability\n * needs no network of its own, and every `null` states why.\n */\nexport const NETWORK_FOR_CAPABILITY: Record<InfraCapability, WildoRuntimeNetwork | null> = {\n [InfraCapability.DOCUMENT_DATABASE]: WildoRuntimeNetwork.DATA_MONGO,\n [InfraCapability.RELATIONAL_DATABASE]: WildoRuntimeNetwork.DATA_POSTGRES,\n [InfraCapability.CACHE_MANAGER]: WildoRuntimeNetwork.DATA_REDIS,\n [InfraCapability.QUEUING_SYSTEM]: WildoRuntimeNetwork.DATA_RABBIT,\n [InfraCapability.OBJECT_STORAGE]: WildoRuntimeNetwork.DATA_OBJECTS,\n [InfraCapability.ANTIVIRUS_SCANNING]: WildoRuntimeNetwork.DATA_ANTIVIRUS,\n // ⚠️ CORRECTED 2026-08-12. Both of the entries below were `null`, on reasoning\n // that measurement disproved while building the 5B service table:\n //\n // - AUDIT_LOG_STORAGE was \"served BY the document/relational database\". It is\n // not: `immudb` is a service of its own, with its own container, and a\n // runtime that writes audit records dials IT rather than a database table.\n // - METRICS_TELEMETRY was \"no application runtime dials them directly today\".\n // Also false — runtimes emit spans and metrics to the collector, and that\n // traffic is live in development. A `null` here would have cut tracing for\n // every runtime the moment segmentation was enforced, with NO readiness\n // check covering it: a first-use failure, silent until someone noticed spans\n // had stopped.\n [InfraCapability.AUDIT_LOG_STORAGE]: WildoRuntimeNetwork.DATA_AUDIT,\n [InfraCapability.METRICS_TELEMETRY]: WildoRuntimeNetwork.DATA_TELEMETRY,\n // Backup remains genuinely operator-side: no application runtime dials it, and\n // the backup tooling runs outside the application's network entirely.\n [InfraCapability.BACKUP_MANAGER]: null,\n};\n\n/**\n * The networks a runtime's container joins.\n *\n * Derived from the SAME declaration as its credentials and its environment\n * topology — see {@link resolveRuntimeBackingServiceAccess}. That is the whole\n * point: a runtime kept off a service's network must also not hold that service's\n * credential nor receive its connect URL, and the only way three enforcement\n * points stay in agreement is by not deriving the answer three times.\n *\n * `PLATFORM` is unconditional. Every runtime — including a worker, which holds no\n * backing-service credentials at all — must reach apps-manager to fetch its own\n * bootstrap material. Withholding it would strand every runtime at boot, and it\n * grants no application data.\n */\nexport function resolveRuntimeNetworkMembership(\n principal: ApplicationRuntimePrincipal | undefined,\n declaration?: RuntimeAccessDeclaration | undefined,\n options?: { readonly servesHttp?: boolean },\n): ReadonlySet<WildoRuntimeNetwork> {\n const access = resolveRuntimeBackingServiceAccess(principal, declaration);\n const networks = new Set<WildoRuntimeNetwork>();\n\n // PLATFORM is for runtimes that FETCH their own bootstrap material — every\n // runtime principal does, including a worker that holds no backing-service\n // credentials at all. A caller with NO principal is not a runtime principal:\n // today that is the static frontend, an nginx container that authenticates to\n // nothing and has no bootstrap material to fetch.\n //\n // This was previously unconditional, which put that frontend on the platform\n // segment. Harmless — the segment carries no application data and the container\n // could not authenticate anyway — but it is reachability nobody asked for, and\n // \"unconditional because every case so far needed it\" is exactly the default a\n // later reader assumes was measured.\n if (principal) networks.add(WildoRuntimeNetwork.PLATFORM);\n\n for (const capability of access.capabilities) {\n const network = NETWORK_FOR_CAPABILITY[capability];\n if (network) networks.add(network);\n }\n\n // Serving HTTP is a property of the DEPLOYMENT (does a proxy route to it?),\n // not of what the runtime declared, so it arrives separately rather than being\n // inferred from the principal kind — an application backend that serves no\n // public route should not be on the edge merely for being a backend.\n if (options?.servesHttp) networks.add(WildoRuntimeNetwork.EDGE);\n\n // Authored, never inferred. See `RuntimeBackingServiceAccess`.\n if (access.requiresInternetEgress) networks.add(WildoRuntimeNetwork.EGRESS);\n\n return networks;\n}\n\n/**\n * Networks that must be declared `internal: true`.\n *\n * Derived by EXCLUSION from the two that legitimately carry a route off the host,\n * so a network added to the enum is internal by default. The safe posture is the\n * one you get by not thinking about it.\n */\nexport function isInternalNetwork(network: WildoRuntimeNetwork): boolean {\n return network !== WildoRuntimeNetwork.EDGE && network !== WildoRuntimeNetwork.EGRESS;\n}\n"]}