@wildo-ai/wildo-cli 1.1.12 → 1.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/commands/config/sync.command.d.ts.map +1 -1
- package/dist/src/commands/config/sync.command.js +1 -0
- package/dist/src/commands/config/sync.command.js.map +1 -1
- package/dist/src/commands/context/journey.command.d.ts.map +1 -1
- package/dist/src/commands/context/journey.command.js +8 -0
- package/dist/src/commands/context/journey.command.js.map +1 -1
- package/dist/src/commands/creation/drive.command.d.ts.map +1 -1
- package/dist/src/commands/creation/drive.command.js +2 -0
- package/dist/src/commands/creation/drive.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.js +8 -0
- package/dist/src/commands/fwk/publish-all.command.js.map +1 -1
- package/dist/src/commands/local/dev.command.d.ts +68 -0
- package/dist/src/commands/local/dev.command.d.ts.map +1 -1
- package/dist/src/commands/local/dev.command.js +216 -8
- package/dist/src/commands/local/dev.command.js.map +1 -1
- package/dist/src/commands/local/doctor.command.d.ts +22 -9
- package/dist/src/commands/local/doctor.command.d.ts.map +1 -1
- package/dist/src/commands/local/doctor.command.js +45 -42
- package/dist/src/commands/local/doctor.command.js.map +1 -1
- package/dist/src/commands/providers/connect.command.d.ts.map +1 -1
- package/dist/src/commands/providers/connect.command.js +11 -1
- package/dist/src/commands/providers/connect.command.js.map +1 -1
- package/dist/src/commands/seal/currency.command.d.ts +13 -0
- package/dist/src/commands/seal/currency.command.d.ts.map +1 -0
- package/dist/src/commands/seal/currency.command.js +52 -0
- package/dist/src/commands/seal/currency.command.js.map +1 -0
- package/dist/src/commands/seal/seal-admin-door.utils.d.ts.map +1 -1
- package/dist/src/commands/seal/seal-admin-door.utils.js +2 -0
- package/dist/src/commands/seal/seal-admin-door.utils.js.map +1 -1
- package/dist/src/commands/seal/verify.command.d.ts +5 -0
- package/dist/src/commands/seal/verify.command.d.ts.map +1 -1
- package/dist/src/commands/seal/verify.command.js +26 -2
- package/dist/src/commands/seal/verify.command.js.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts +19 -0
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.js +75 -11
- package/dist/src/services/application/content-guardrail-classifier.service.js.map +1 -1
- package/dist/src/services/application/local-provider-doubles.service.d.ts +98 -0
- package/dist/src/services/application/local-provider-doubles.service.d.ts.map +1 -0
- package/dist/src/services/application/local-provider-doubles.service.js +214 -0
- package/dist/src/services/application/local-provider-doubles.service.js.map +1 -0
- package/dist/src/services/application/system-of-record-simulators.service.d.ts +21 -2
- package/dist/src/services/application/system-of-record-simulators.service.d.ts.map +1 -1
- package/dist/src/services/application/system-of-record-simulators.service.js +21 -12
- package/dist/src/services/application/system-of-record-simulators.service.js.map +1 -1
- package/dist/src/services/companion/creation-drive.service.d.ts +32 -2
- package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-drive.service.js +61 -4
- package/dist/src/services/companion/creation-drive.service.js.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.d.ts +6 -0
- package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.js +7 -1
- package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.js +11 -3
- package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.d.ts +9 -0
- package/dist/src/services/data-services/data-services.schemas.d.ts.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.js +9 -0
- package/dist/src/services/data-services/data-services.schemas.js.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js +7 -2
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.d.ts.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js +22 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.js +1 -0
- package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.js +5 -0
- package/dist/src/services/environment/authored-infra-member-authority.js.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.js +6 -3
- package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.d.ts +6 -0
- package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.js +24 -1
- package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.d.ts.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.js +1 -0
- package/dist/src/services/environment/environment-hydration.utils.js.map +1 -1
- package/dist/src/services/environment/environment.schemas.d.ts +7 -1
- package/dist/src/services/environment/environment.schemas.d.ts.map +1 -1
- package/dist/src/services/environment/environment.schemas.js.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts +2 -0
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.js +4 -0
- package/dist/src/services/environment/runtime-bootstrap.service.js.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.d.ts +13 -0
- package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.js +24 -7
- package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
- package/dist/src/services/registry/provider-connect.service.d.ts +57 -1
- package/dist/src/services/registry/provider-connect.service.d.ts.map +1 -1
- package/dist/src/services/registry/provider-connect.service.js +63 -2
- package/dist/src/services/registry/provider-connect.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/scripts/app-dependency-alignment/propagated-engine-overrides.json +1 -1
- package/wildo-framework.info.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.schemas.js","sourceRoot":"","sources":["../../../../src/services/credentials/credentials.schemas.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,0FAA0F;AAC1F,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACL,sCAAsC,EACtC,2CAA2C,EAC3C,8BAA8B,EAC9B,oBAAoB,EACpB,oBAAoB,EACpB,mCAAmC,EACnC,gCAAgC,EAChC,sCAAsC,EACtC,cAAc,EACd,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,qCAAqC,EACrC,2BAA2B,EAC3B,oCAAoC,EACpC,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAiClH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,6EAAiD,CAAA;IACjD,qFAAyD,CAAA;IACzD,mFAAuD,CAAA;IACvD,mFAAuD,CAAA;AACzD,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,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D,CAAC,MAAM,CAAC,cAAc,EACzB,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,gBAAgB,CAAC;YACxB,OAAO,EAAE,+DAA+D;SACzE,CAAC,CAAC;IACL,CAAC;IACD,IAAI,MAAM,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QACtC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC;YACtC,OAAO,EAAE,kGAAkG;SAC5G,CAAC,CAAC;IACL,CAAC;IACD,IACE,MAAM,CAAC,gBAAgB,EAAE,OAAO;WAC7B,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,EACvD,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;YACrC,OAAO,EAAE,sGAAsG;SAChH,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EACjB,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C,CAAC","sourcesContent":["// Boundary adapter: Zod schemas validate user-facing files (secrets.json, config.json)\n// against domain enums. This import direction (validation → domain types) is intentional.\nimport z from \"zod\";\nimport {\n APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ApplicationCreationVerificationConfigSchema,\n BackingServicesEnvConfigSchema,\n BackingServiceSource,\n WildoCdnConfigSchema,\n WildoSystemsOfRecordEnvConfigSchema,\n WildoPlatformStorageConfigSchema,\n WildoPlatformKeyManagementConfigSchema,\n DatabaseEngine,\n PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n WildoAuthConfigSchema,\n WildoDeploymentRuntime,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLocalDataStorage,\n EnvironmentServiceProfile,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoProviderSelectionOverridesSchema,\n WildoInfraEmailConfigSchema,\n WildoOwnershipDnsStandInConfigSchema,\n WildoRemoteProviderSchema,\n} from '@wildo-ai/platform-config-lib';\nimport { RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { PROVIDER_SENSITIVE_ENV_KEYS } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { LiveEnvKeySet, memoiseOverCatalogue } from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\n\n// ============================================================================\n// Default credential usernames (not secrets — safe to store as constants)\n// ============================================================================\n\n// ---------------------------------------------------------------------------\n// Credential input types (shared between modules and services)\n// ---------------------------------------------------------------------------\n\nexport interface AdminUserInput {\n email: string;\n firstName: string;\n lastName: string;\n /**\n * Optional operator-supplied initial password.\n *\n * When `undefined`, the secrets writer auto-generates a 16-char password\n * (preserving the historical zero-friction local-setup UX where the\n * generated password is printed at the end of `wildo setup`).\n *\n * When provided (today only via the `WILDO_INIT_ADMIN_PASSWORD` env-var\n * seed in {@link platformAdminUserModule}), the explicit value is\n * threaded into `Wildo_Application_Secrets.admin.password` and reused\n * by every downstream consumer (`secrets-writer`, `env-vars-builder`,\n * `k8s-bootstrap`, `app-bootstrap.service`). This is the single\n * non-interactive entry-point for CI flows that need a deterministic\n * admin password.\n */\n password?: string;\n}\n\n/**\n * CLI-namespaced env-var contract for non-interactive / CI-driven seeding\n * of the platform admin identity collected by `wildo setup` and by\n * `wildo init`, which mints the application's own `local` secrets.json\n * (issue #155) and reads these same seeds when no `--admin-*` flag is given.\n *\n * Why a CLI-specific namespace (`WILDO_INIT_ADMIN_*`) instead of reusing\n * the apps-manager runtime contract (`ADMIN_EMAIL` / `ADMIN_PASSWORD` /\n * `ADMIN_FIRST_NAME` / `ADMIN_LAST_NAME`):\n *\n * - The apps-manager keys describe the **running platform process's**\n * admin user (consumed by `init-mode-startup.apps-manager.service.ts`\n * in INIT mode) — they are runtime config for a long-lived service.\n *\n * - These keys describe the **operator running the CLI scaffold** —\n * one-shot input for the local setup wizard. Conflating them risks\n * accidentally seeding a CI runner's apps-manager process with the\n * developer's personal credentials (or vice-versa).\n *\n * Contract semantics (per Slice 2 / 2.3 design decision, TARGETED scope):\n * - Email / first name / last name: env value, when present, is used as\n * the prompt default. The operator can still override interactively.\n * - Password: env value, when present, is threaded directly into\n * `AdminUserInput.password` (skipping the auto-generator). When\n * absent, the secrets writer auto-generates a 16-char password — this\n * preserves the historical UX and is intentional.\n */\nexport enum WildoCliInitAdminEnvKeys {\n WILDO_INIT_ADMIN_EMAIL = 'WILDO_INIT_ADMIN_EMAIL',\n WILDO_INIT_ADMIN_FIRSTNAME = 'WILDO_INIT_ADMIN_FIRSTNAME',\n WILDO_INIT_ADMIN_LASTNAME = 'WILDO_INIT_ADMIN_LASTNAME',\n WILDO_INIT_ADMIN_PASSWORD = 'WILDO_INIT_ADMIN_PASSWORD',\n}\n\n/**\n * The same one-shot CLI contract, for the SECOND administrator (#575).\n *\n * A separate enum rather than four more members on {@link WildoCliInitAdminEnvKeys}, because the two\n * identities have different provenance rules and a shared enum would hide that. The admin's fields\n * are always operator-authored; the approver's are operator-authored on a REMOTE environment and\n * DERIVED from the admin on a local one. Reading them from one vocabulary invites a caller to treat\n * a derived value and a stated one as interchangeable, which is the whole distinction\n * {@link resolveApproverIdentity} exists to keep.\n *\n * Unlike the admin keys the PASSWORD is not optional-with-a-generator here: locally the approver\n * shares the admin's password by construction, and remotely a generated password nobody was told\n * about would produce an approver who cannot sign in — an account that exists and cannot act is\n * worse than a refusal, because the refusal is the part that gets fixed.\n */\nexport enum WildoCliInitApproverEnvKeys {\n WILDO_INIT_APPROVER_EMAIL = 'WILDO_INIT_APPROVER_EMAIL',\n WILDO_INIT_APPROVER_FIRSTNAME = 'WILDO_INIT_APPROVER_FIRSTNAME',\n WILDO_INIT_APPROVER_LASTNAME = 'WILDO_INIT_APPROVER_LASTNAME',\n WILDO_INIT_APPROVER_PASSWORD = 'WILDO_INIT_APPROVER_PASSWORD',\n}\n\nexport interface ProviderKeysInput {\n /**\n * Provider secrets keyed by their exact env-var name (e.g. `OPENAI_API_KEY`,\n * `STRIPE_SECRET_KEY`), collected in the interactive `wildo setup` flow from\n * the registry-derived provider selection. This is the single map for ALL\n * provider secrets — there are no per-provider convenience fields; the setup\n * UX and the backend registry both address providers by env-var name.\n */\n providerEnv?: Record<string, string>;\n /**\n * GitHub ORGANIZATION integration (source-control), distinct from the GitHub\n * OAuth2 provider secret: these feed the `github` block of `secrets.json`,\n * not `providerEnv`.\n */\n githubOrgUrl?: string;\n githubAdminUser?: string;\n githubAdminToken?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Default credential usernames (not secrets — safe to store as constants)\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_PLATFORM_ENV_INTERNAL_SERVICE_CREDENTIAL_USERNAME = {\n MONGODB_ROOT_USER: 'wildo',\n VALKEY_ADMIN_USER: 'default',\n PG_ADMIN_USER: 'wildo_admin',\n RABBITMQ_ADMIN_USERNAME: 'wildo',\n MINIO_ACCESS_KEY: 'wildo',\n} as const;\n\n\n// ============================================================================\n// Sensitive env var classification\n// ============================================================================\n\n/**\n * Env var keys classified as sensitive (credentials, passwords, API keys).\n * Used to separate secret values from plain-text config when generating\n * deployment artifacts (K8s Secret vs ConfigMap, Docker env_file, etc.).\n *\n * Infrastructure keys are listed explicitly. Provider credentials come from the COMPOSED\n * provider catalogue via `PROVIDER_SENSITIVE_ENV_KEYS` — engine tier plus every provider\n * package discovery has registered.\n *\n * A LIVE view rather than a `new Set([...])` snapshot, and the difference is load-bearing\n * (#329): this module is evaluated on the CLI's first touch of the credential layer, which is\n * always before an application's provider packages have been discovered. A snapshot would have\n * frozen the answer at \"engine providers only\", so a package-shipped provider's API key would\n * have been classified as plain config and written into a Kubernetes `ConfigMap`. The static\n * halves are still snapshotted — they are compile-time constants and cannot move.\n */\nconst STATIC_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new Set([\n // Shared platform runtime env contract secrets\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n // Shared app-backend env contract secrets\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n]);\n\nexport const SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(\n // Memoised against the composition generation rather than rebuilt per `.has()`: the K8s secrets\n // generator asks this once per environment variable, and the union is only ever invalidated by a\n // registration.\n memoiseOverCatalogue(() => new Set([...STATIC_SENSITIVE_ENV_KEYS, ...PROVIDER_SENSITIVE_ENV_KEYS])),\n);\n\n// ============================================================================\n// Zod schemas for secrets.json and config.json (CLI validation)\n// ============================================================================\n\nexport const PlatformEnvSecretsJson_Schema = z\n .object({\n mongodb: z.object({\n rootUser: z.string(),\n rootPassword: z.string(),\n }).optional(),\n valkey: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }).optional(),\n postgresql: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }),\n rabbitmq: z.object({\n adminUsername: z.string(),\n adminPassword: z.string(),\n erlangCookie: z.string(),\n }),\n storage: z.object({\n accessKey: z.string(),\n secretKey: z.string(),\n }),\n platform: z.object({\n primarySecret: z.string(),\n /** Dedicated shared secret for admin operations (CLI ↔ apps-manager). */\n adminSecret: z.string(),\n appsManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }),\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair (per-service, mirrors\n * `appsManager`). Private half → crontabs (signs every SCHEDULED_CRON / MINION_TICK job\n * token); public half → apps-manager, which distributes it into each app's\n * `PLATFORM_CRONTABS_BATCHES_MANAGER` verify slot. Declared in\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` and therefore minted both at setup and by the\n * idempotent provisioning self-heal (`wildo local dev` / `wildo local up` preflight,\n * `wildo config sync`), so an environment predating the keypair acquires it on the\n * next command. `.optional()` at the schema layer (mirrors `immudb`) so a secrets.json\n * predating this fix still PARSES — but unlike immudb there is NO graceful degradation:\n * the crontabs config + apps-manager distribution FAIL-LOUD when it is absent (a missing\n * key silently dead-lettered every scheduled tick before this fix).\n */\n crontabsBatchesManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }).optional(),\n /**\n * apps-manager's response keys (#2921), current and next. The current private half → apps-manager\n * (`PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY`); both public halves → every application runtime\n * (`PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`). Declared in `FRAMEWORK_MANAGED_SECRET_MATERIALS`, so the\n * provisioning self-heal mints it on an environment that predates it. `.optional()` so such a secrets.json still\n * parses; the environment builders FAIL LOUD when it is absent, because apps-manager may not answer unsigned.\n */\n appsManagerResponseSigning: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n nextPrivateKey: z.string(),\n nextPublicKey: z.string(),\n }).optional(),\n /**\n * The platform's key-encryption root (#2891): apps-manager seals every LOCAL private key under `current`.\n * `previous` exists only between a rotation and the re-seal that retires it. → `PLATFORM_KEY_ENCRYPTION_ROOT` /\n * `PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT`, apps-manager only. `.optional()` so a secrets.json that predates it\n * still parses; the self-heal mints it and the apps-manager builder fails loud without it.\n */\n keyEncryptionRoot: z.object({\n current: z.string(),\n previous: z.string().optional(),\n }).optional(),\n }),\n /**\n * The APPLICATION's own operator secret — distinct from `platform` above, which is the\n * PLATFORM's, and which an application must never hold.\n *\n * One field, and a section of its own rather than a key under `platform`, because the tier is\n * the whole point: `resolveForbiddenPlatformCredentials` refuses to emit any platform-tier\n * credential into an application-tier env, and this value must go INTO that env. Filing it\n * under `platform` would have made it unemittable by the very guard that protects the boundary.\n *\n * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`\n * written before this existed must still PARSE. Unlike an identity it IS mintable, so it is\n * declared in `FRAMEWORK_MANAGED_SECRET_MATERIALS` and the idempotent self-heal fills it on the\n * next command — an environment predating it acquires one without an operator typing anything.\n */\n application: z.object({\n /**\n * Gates the data-seeding and external-data admin surfaces. 48 bytes, minted, rotatable.\n *\n * MINTED rather than operator-authored, and the trade is worth stating. The external-data\n * controller's header defends an unset default — *\"so a fresh deployment never accidentally\n * exposes a door that reaches a third party's production system\"* — and that reasoning was\n * written when there was NO channel to author it, so \"unset\" was the only reachable state.\n * With a channel, the choice is between a door nobody can open and a door behind 48 bytes of\n * entropy. The direct analogue one tier up settles it: `platform.adminSecret` is minted at the\n * same length for the same kind of surface. Reversible — remove this from the materials\n * registry and absent-by-default returns, since every consumer already answers 503 on absence.\n */\n adminSecret: z.string(),\n }).optional(),\n admin: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }),\n /**\n * The SECOND platform administrator — the one who approves an application-wide access grant.\n *\n * Not a nicety. `applicationAccessGrantApproverIsDistinct` refuses `operator === approver` and\n * refuses an ABSENT approver, and the application-scoped grant has deliberately no\n * auto-approval branch — the schema states why: this grant names no tenant, so *\"a grant that\n * could approve itself would make the two-person rule ceremonial\"*. A deployment with one\n * administrator therefore cannot use the widest read the system offers, at all. The refusal was\n * built and the party who discharges it never was (#575).\n *\n * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`\n * written before this existed must still PARSE. Unlike a generated keypair it cannot be\n * self-healed into place, because an identity is not mintable — see the note on\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS`' `ADMIN_PASSWORD` material, which is careful to declare\n * only the password so that provisioning never invents an admin identity. An environment\n * predating this acquires an approver by re-running setup, or by authoring the block.\n *\n * Locally this is DERIVED from `admin` (see `resolveApproverIdentity`) and shares its password,\n * which makes the two-person rule ceremonial there — deliberately, because the alternative is a\n * developer who cannot exercise an application-wide read at all. That is exactly why a\n * non-local environment gets no derivation and must state the approver itself.\n */\n approver: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }).optional(),\n atlas: z.object({\n apiPublicKey: z.string(),\n apiPrivateKey: z.string(),\n }).optional(),\n /**\n * immudb state-signing keypair — the cryptographic whole-server-substitution defense\n * for the tamper-evident audit store (`COMPLIANCE_AUDIT_TRAIL`). Auto-generated (ECDSA\n * P-256) from the `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry — at setup for a new\n * environment, and by the idempotent provisioning self-heal for an existing one; the two\n * halves flow to DIFFERENT places and MUST NOT be conflated:\n *\n * - `stateSigningPrivateKey` (SEC1 \"EC PRIVATE KEY\" PEM) — mounted into the SELF-hosted\n * immudb server (`--signingKey`, immudb `x509.ParseECPrivateKey`) so it signs its\n * `ImmutableState`. SERVER-side ONLY: rides the k8s `immudb-secret` / the compose\n * local-data key file. NEVER injected into `providerEnv` or any app-pod env.\n * - `stateSigningPublicKey` (SPKI PEM) — pinned by the audit client via the\n * `IMMUDB_STATE_PUBLIC_KEY` provider secret; the client verifies the server's signed\n * state against it (immudb-verified-kv-client `verifyImmutableStateSignature`). A\n * substituted immudb cannot forge the signature without the private key, so substitution\n * is cryptographically caught. Public material — safe to deliver to every app runtime.\n *\n * Optional at the schema layer (mirrors mongodb/valkey): a secrets.json that lacks it\n * still validates, and immudb then runs UNSIGNED (client warns \"signing OFF\") — graceful\n * degradation, not a hard failure. That path now only survives for a CI-reconstructed\n * secrets.json (`reconstructSecretsFromEnv`, which publishes no immudb material); a\n * file-backed environment is provisioned automatically on the next CLI command.\n */\n immudb: z.object({\n stateSigningPrivateKey: z.string(),\n stateSigningPublicKey: z.string(),\n /**\n * #1696 — the self-hosted immudb server's built-in `immudb` SYSADMIN password, a PLATFORM secret. The\n * server is initialised with it (compose `IMMUDB_ADMIN_PASSWORD`, the k8s `immudb-secret`), and\n * apps-manager — the only runtime that receives it (`IMMUDB_ADMIN_PASSWORD` in its env) — logs in with it\n * to give each application its OWN database and its OWN `READ_WRITE` user. No application holds it.\n *\n * Until #1696 the server's admin password was COPIED from the owning application's operator-authored\n * `providerEnv.IMMUDB_PASSWORD`, which is also the credential every application's audit sink logged in\n * with — so every hosted application held the sysadmin of every application's audit data. Minted here,\n * it is no application's value.\n *\n * Its own material (`IMMUDB_ADMIN_PASSWORD`) rather than a third key on the state-signing keypair, so an\n * environment that predates it acquires only this key and its keypair is never re-minted. `.optional()` so\n * a `secrets.json` written before it still parses; the self-heal fills it on the next CLI command.\n */\n adminPassword: z.string().optional(),\n }).optional(),\n /**\n * Issue #74 — the SCRAM password `mongot` authenticates to mongod with, as a\n * `searchCoordinator`-roled user in mongod's `admin` database. Auto-generated from the\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry.\n *\n * Only the password lives here. The USERNAME is a framework-owned service identity\n * (`MONGOT_SYNC_SOURCE.USERNAME`), so it is a code constant rather than a stored value —\n * storing it would create a second place a rename has to reach.\n *\n * Both deployment lanes read THIS one value, which is the point: mongot never receives a\n * password directly, it reads a FILE, and the user it authenticates as is created by the\n * `mongodb-init` step. Three consumers of one secret is exactly the shape that drifts if\n * each lane mints its own — the immudb admin password was that defect one datastore over\n * (contract stated, k8s lane implemented, compose lane silently on the packaged default).\n *\n * `.optional()` mirrors mongodb/valkey/immudb so a secrets.json predating this parses; a\n * file-backed environment acquires it on the next self-heal, and an environment that\n * self-hosts no mongod never needs it.\n */\n mongot: z.object({\n syncSourcePassword: z.string(),\n }).optional(),\n /**\n * #2933 — the self-hosted OpenBao that holds the platform's custodied keys (`platformKeyManagement.vault.source ===\n * 'self'`). Framework-managed: the static unseal key and the ids of apps-manager's two tokens and of the recovery\n * token, which the server creates at its first start. None is rotated by `--rotate-secrets` (see the materials); the\n * break-glass verbs `wildo keys vault-rotate-tokens` and `vault-rotate-unseal-key` move them on the running server. Only the OpenBao\n * container and apps-manager receive any of it; no application does. `.optional()` so a `secrets.json` written\n * before it parses; the self-heal fills it on the next CLI command.\n */\n platformKeyVault: z.object({\n unsealKey: z.string(),\n signerToken: z.string(),\n operatorToken: z.string(),\n /**\n * #3006 — the break-glass RECOVERY token's id: the server issues it at its first start, and only\n * `wildo keys vault-rotate-tokens` / `vault-rotate-unseal-key` read it. The OpenBao container receives it (read\n * once, at that first start); apps-manager and every runtime never do (the env builder forbids it). Optional so a\n * section written before #3006 parses; the self-heal mints it, and a server initialized before then never knew it.\n */\n recoveryToken: z.string().optional(),\n /**\n * #3006 — set only between the two steps of `wildo keys vault-rotate-unseal-key`: the key the server's storage may\n * still be wrapped under. Rendered as the static seal's `previous_key`; dropped once the root key is re-wrapped.\n */\n previousUnsealKey: z.string().optional(),\n }).optional(),\n /**\n * #2933 — the two tokens for the operator's OWN Vault (`platformKeyManagement.vault.source === 'managed'`),\n * issued by the operator under the signer and operator policies the key-management contracts state. Operator-typed,\n * like `atlas`: the framework never generates, rotates or renews them here (apps-manager renews them at runtime).\n */\n platformKeyVaultManaged: z.object({\n signerToken: z.string().min(1),\n operatorToken: z.string().min(1),\n }).optional(),\n /**\n * #2934 — the user PIN of the platform's PKCS#11 token (`platformKeyManagement.pkcs11`). Operator-typed, like the\n * managed Vault's tokens: the HSM's owner sets it, and the framework never generates or rotates it.\n */\n platformKeyPkcs11: z.object({\n pin: z.string().min(1),\n }).optional(),\n /**\n * Protocol-aware provider credentials keyed by the actual process env var\n * name that should be injected into runtime services.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n /**\n * System-of-record credentials, keyed by the DERIVED environment-variable name\n * (`WILDO_SOR_<NAME>__<SLOT>`, #1055).\n *\n * ## Why it is flat, and not a tree keyed by instance (R5)\n *\n * A per-instance tree would be the obvious shape and it breaks two mechanisms. The CI secret\n * reconstruction walks a STATIC table of secret paths, and `isOptionalSecretPath` THROWS on a\n * `z.record` node — so an instance-keyed section listed there crashes `wildo config sync --domain\n * cicd`. And `envVarSuffixForSecretPath` is not injective, so two instances of one vendor would\n * collapse onto one CI input. Flat-by-variable-name is the shape `providerEnv` already uses for\n * the same reason, and per-instance structure is recovered by PARSING the key — which the `__`\n * delimiter makes unambiguous.\n *\n * ## Why it is not `providerEnv` itself\n *\n * That map is attributed to a PROVIDER's secrets contract by `filterProviderEnvToScope`, and a\n * system of record is deliberately not a provider (D10). Sharing the map would make every\n * instance's credential look like a provider key to the scoping logic — and be silently dropped by\n * it once the vendor leaves `providers.scopes`.\n *\n * ## Why it must be DECLARED here at all\n *\n * `wildo config sync --rotate-secrets` and `wildo setup` re-write `secrets.json` THROUGH this\n * schema. An undeclared section is not preserved — it is deleted. Declaring it is the whole\n * mechanism that stops an operator's ERP credentials disappearing on the next rotation; rotation\n * itself never touches the section, because it is registry-driven and these are not\n * framework-managed secrets.\n */\n systemsOfRecordEnv: z.record(z.string(), z.string()).optional(),\n /**\n * Verification secrets of the application's INBOUND endpoints (`POST /webhooks/app/{endpointKey}`,\n * #1596), keyed by the DERIVED variable name `WILDO_INBOUND_<ENDPOINT_KEY>__SECRET`\n * (`deriveInboundEndpointSecretEnvVarName` in `@wildo-ai/saas-models`).\n *\n * Flat and keyed by variable name for the reasons `systemsOfRecordEnv` gives above: the key space is\n * open (one key per endpoint the application declares) and the endpoint is recovered by parsing the\n * name. Not `providerEnv`, because an inbound endpoint is the application's own and not a provider's,\n * so `filterProviderEnvToScope` would drop it.\n *\n * Delivered to the application BACKEND only — the one runtime that mounts the endpoint — and stripped\n * from every minion, which would otherwise hold a signing secret it cannot use. Rotation leaves it\n * alone: the SENDER holds the same secret, so changing it here alone breaks every delivery.\n */\n inboundEndpointEnv: z.record(z.string(), z.string()).optional(),\n github: z.object({\n orgUrl: z.string().optional(),\n adminUser: z.string().optional(),\n adminToken: z.string().optional(),\n }).optional(),\n });\nexport type PlatformEnvSecretsJson = z.infer<typeof PlatformEnvSecretsJson_Schema>;\n\n/**\n * Who a credential belongs to when several applications share one environment's infrastructure.\n *\n * An application HOSTED on another's infrastructure (`infrastructureHost`) reads every shared credential\n * from its host's `secrets.json` and keeps only its own in its file — so there is exactly one copy of a\n * shared credential, held by the one application that runs the thing it opens.\n */\nexport enum SecretOwner {\n /**\n * The identity of a shared container or platform service: backing-service admin credentials, the\n * platform's secrets and signing keypairs, the immudb and mongot material, the platform's Atlas and\n * GitHub access. Held by the infrastructure host only.\n */\n SHARED_INFRASTRUCTURE = 'shared-infrastructure',\n /**\n * Material only this application uses: its own operator-door secret, its provider API keys, and the\n * administrator and approver identities its registration seeds as its first users.\n */\n APPLICATION = 'application',\n}\n\n/**\n * Owner of every top-level `secrets.json` section. Total over the schema by type, so a section added\n * tomorrow does not compile until somebody decides whether a hosted application may hold its own copy.\n *\n * `admin` and `approver` are APPLICATION although the platform's own INIT also reads them: a hosted\n * application never runs platform INIT (that is its host's), and the only thing it does with them is\n * seed its OWN first administrator and approver at registration.\n */\nexport const SECRETS_SECTION_OWNERSHIP: Readonly<Record<keyof PlatformEnvSecretsJson, SecretOwner>> = {\n mongodb: SecretOwner.SHARED_INFRASTRUCTURE,\n valkey: SecretOwner.SHARED_INFRASTRUCTURE,\n postgresql: SecretOwner.SHARED_INFRASTRUCTURE,\n rabbitmq: SecretOwner.SHARED_INFRASTRUCTURE,\n storage: SecretOwner.SHARED_INFRASTRUCTURE,\n platform: SecretOwner.SHARED_INFRASTRUCTURE,\n application: SecretOwner.APPLICATION,\n admin: SecretOwner.APPLICATION,\n approver: SecretOwner.APPLICATION,\n atlas: SecretOwner.SHARED_INFRASTRUCTURE,\n immudb: SecretOwner.SHARED_INFRASTRUCTURE,\n mongot: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyVault: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyVaultManaged: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyPkcs11: SecretOwner.SHARED_INFRASTRUCTURE,\n providerEnv: SecretOwner.APPLICATION,\n /*\n * APPLICATION. These are the credentials for the external systems THIS application reads from, keyed by the\n * instance names its own saas config declares. A hosted application authors its own systems of record (or\n * `{ enabled: false }`), so inheriting its host's would hand it a credential to somebody else's ERP.\n */\n systemsOfRecordEnv: SecretOwner.APPLICATION,\n /* APPLICATION: the secrets of endpoints THIS application's own handlers declare, agreed with its own senders. */\n inboundEndpointEnv: SecretOwner.APPLICATION,\n github: SecretOwner.SHARED_INFRASTRUCTURE,\n};\n\n/**\n * The sections of `secrets` a hosted application holds itself — everything else is its host's. Absent\n * sections stay absent; nothing is defaulted.\n */\nexport function projectApplicationOwnedSecrets(secrets: Partial<PlatformEnvSecretsJson>): Partial<PlatformEnvSecretsJson> {\n const projected: Record<string, unknown> = {};\n for (const [section, owner] of Object.entries(SECRETS_SECTION_OWNERSHIP)) {\n const value = (secrets as Record<string, unknown>)[section];\n if (owner === SecretOwner.APPLICATION && value !== undefined) {\n projected[section] = value;\n }\n }\n return projected as Partial<PlatformEnvSecretsJson>;\n}\n\nconst PlatformEnvStorageConfig_Schema = z.object({\n provider: z.enum(['minio']),\n useSsl: z.boolean(),\n bucket: z.string(),\n});\n\nconst PlatformEnvPostgresqlConfig_Schema = z.object({\n database: z.string(),\n sslMode: z.string(),\n});\n\n/**\n * Slice 6 / F-20 — typed external-service binding for ClamAV (managed\n * antivirus scanner): the validate command reads `host` through this\n * schema, so a typo at the persisted-config layer fails at parse time.\n */\nexport const ClamavExternalServiceSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().positive().optional(),\n tls: z.boolean().optional(),\n});\nexport type ClamavExternalServiceConfig = z.infer<typeof ClamavExternalServiceSchema>;\n\n/**\n * Slice 3 deep-review H-1 (2026-04-13): use `z.strictObject` (not `z.object`)\n * at the root so that unknown top-level keys in a persisted\n * `environments/<env>/config.json` fail-closed at parse time instead of\n * being silently stripped. Today the loader (`environment-registry.service`)\n * uses `safeParse` and treats a parse failure as a cache miss, so this\n * change does not crash the CLI at boot — but it does ensure that\n * `wildo config validate` (which calls `parse`) catches a typoed root key\n * as a hard error, matching the strict posture of `WildoSaasConfigSchema`.\n */\nexport const PlatformEnvConfigJson_Schema = z.strictObject({\n type: z.enum(WildoLocationType),\n runtime: z.enum(WildoDeploymentRuntime),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n /**\n * Where this environment's self-hosted backing services keep their data — a Docker named volume\n * or a host bind mount under `local_data/<service>/`.\n *\n * `.optional()` because this is a STRICT schema read back from a `config.json` written before the\n * field existed, and a parse failure is treated as a cache miss that silently discards the whole\n * record. Absence is read through `resolveLocalDataStorage`, which derives it from `locationType`\n * — so an environment provisioned before this field keeps a correct answer rather than an empty\n * one, and does not have to be re-synced to get it.\n */\n localDataStorage: z.enum(WildoLocalDataStorage).optional(),\n /**\n * The environment's service profile (#2303), projected from the descriptor. Optional for the same reason as\n * `localDataStorage`: a `config.json` written before the field existed must still parse, and absence reads as\n * `FULL` (`DEFAULT_ENVIRONMENT_SERVICE_PROFILE`), which is what that environment has always run.\n */\n serviceProfile: z.enum(EnvironmentServiceProfile).optional(),\n database: z.object({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Slice 4.B.0 (2026-05-07): managed-brand identifier when\n * `source === MANAGED`. For Mongo: `'atlas'`. For Postgres:\n * one of `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' |\n * 'supabase' | 'neon' | 'render'`. Generalized from the\n * pre-reshape source-only model where `'atlas'` was a `source`\n * value.\n */\n provider: z.string().min(1).optional(),\n }),\n /**\n * Which declared backing store the APPLICATION's own resources persist to — mirrored from the\n * authored `applicationDatabase` in `wildo.infra.<env>.config.ts`.\n *\n * Distinct from `database` directly above, which is the PLATFORM's engine. The two move\n * independently: a PostgreSQL platform can host a MongoDB application and vice versa.\n *\n * Written RESOLVED by the current CLI (absence in the infra config means PostgreSQL, #1571). OPTIONAL\n * only so an older `config.json` still parses; a reader of an absent value resolves it through\n * `resolveApplicationDatabaseEngine`, never through a default of its own.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n }).optional(),\n infrastructure: z.object({\n storage: PlatformEnvStorageConfig_Schema,\n postgresql: PlatformEnvPostgresqlConfig_Schema,\n }),\n /**\n * Authored backing-services snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. Carries per-service overrides\n * (host/port/name/vhost/endpoint/bucket/database) that the\n * `ServiceAddressResolver`, docker-compose generator, and env-vars-builder\n * use to honor the author's intent. When omitted (legacy generated\n * configs), all consumers fall back to catalog defaults.\n *\n * Persisted shape matches the author shape 1:1 — the canonical contract\n * lives in `BackingServicesEnvConfigSchema` so a future CLI run that\n * re-syncs from infra config produces a stable JSON snapshot.\n */\n backingServices: BackingServicesEnvConfigSchema.optional(),\n /**\n * Authored `serviceAuth` policy snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. This is the SOURCE OF TRUTH for\n * platform-managed JWT TTLs (`accessTokenExpirationMinutes` /\n * `refreshTokenExpirationDays`) seeded into every `Wildo_Application_Config`\n * at apps-manager init time. Authored value > schema default (15 / 30).\n * When the field is absent at parse time, the apps-manager init defaults\n * flow falls back to `WildoAuthConfigSchema.parse({})` so the runtime\n * backend always receives a fully-defined `jwt` block.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n /**\n * Authored logging posture snapshot mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 3.5). Persisted so the runtime contract survives a\n * `wildo config sync` cycle: `env-vars-builder` reads it back to emit\n * `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS` for every long-running\n * platform/application process, and `LoggerService.loadConfiguration`\n * consumes the env vars at boot. Missing => LoggerService keeps its\n * built-in defaults (level `debug`, pino-pretty auto-detect by\n * `APPLICATION_ENV`).\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Authored OTLP telemetry posture mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 2 Phase 5). Persisted so `env-vars-builder` can project `OTEL_*` for the\n * `--import` preload across a `wildo config sync` cycle. Missing => telemetry off.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Authored per-environment external-provider SELECTION override mirrored\n * from `wildo.infra.<env>.config.ts` (2026-07-10). Persisted so\n * `env-vars-builder` can project `WILDO_PROVIDER_SELECTION_OVERRIDES` across\n * a `wildo config sync` cycle; `ExternalProvidersRegistryBackendService`\n * reads it at capability-resolution time. Missing => the app-wide\n * `wildo.saas.config.ts` selection applies unchanged.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Authored per-environment email values mirrored from `wildo.infra.<env>.config.ts`. Persisted so\n * `env-vars-builder` can project `WILDO_INBOUND_EMAIL_SHARED_DOMAIN` across a `wildo config sync` cycle. Missing =>\n * the backend configuration's `email.inbound.sharedDomain` applies unchanged.\n */\n email: WildoInfraEmailConfigSchema.optional(),\n /**\n * LOCAL-ONLY ownership-DNS stand-in mirrored from `wildo.infra.local.config.ts` (#2519). Persisted so\n * `env-vars-builder` can project `WILDO_OWNERSHIP_DNS_STAND_IN_URL` across a `wildo config sync` cycle. Missing =>\n * every domain-ownership challenge asks public DNS.\n */\n ownershipDnsStandIn: WildoOwnershipDnsStandInConfigSchema.optional(),\n // No `documentationSite` (#2310): its origins are BUILD inputs of the documentation image, which the image build and\n // the CI workflow read from the authored descriptor. No runtime reads them, so `config.json` does not carry them.\n /**\n * Generated snapshot of the local authored application-creation verification\n * posture. Env generation consumes this snapshot; `.env` is only its sink.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n /**\n * Public domain (`WildoInfraEnvConfig.publicDomain`) — the\n * runtime-agnostic external hostname browsers and reverse proxies\n * resolve. Required at the persisted-config layer because the\n * authored schema requires it; a hand-edited config that drops the\n * field fails Zod parse with a clear error instead of silently\n * defaulting at read time.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public subdomain map (`WildoInfraEnvConfig.serviceHosts`) —\n * mirrored from the authored infra config. `<serviceKey> → subdomain chain`\n * (or `''` for apex) under `publicDomain`. Consumed by the K8s application\n * endpoint builder + ingress generator via `buildServicePublicHost`. Optional\n * — an unauthored key falls back to `<serviceKey>.<publicDomain>`.\n */\n serviceHosts: z.record(z.string().min(1), z.string()).optional(),\n /**\n * Per-service CDN publish config (`WildoInfraEnvConfig.cdn`) — mirrored from\n * the authored infra config. `<serviceKey> → {enabled, bucket?, bucketPrefix?,\n * vendor}`. Reuses the authoritative `WildoCdnConfigSchema` from config-lib\n * (single source of truth — no loose re-declaration). Optional: an unmapped\n * or `enabled: false` service is nginx-pod-served (the default). Consumed by\n * the deploy render (nginx-skip) + `wildo frontend publish`.\n */\n cdn: z.record(z.string().min(1), WildoCdnConfigSchema).optional(),\n /**\n * The platform tier's own bucket, remote-only (`WildoInfraEnvConfig.platformStorage`, #1112). Rendered into the\n * platform services' env through `resolvePlatformObjectStorageBucket`; absent means the fixed platform bucket.\n */\n /**\n * WHERE each declared system of record lives in this environment, mirrored from the authored\n * `wildo.infra.<env>.config.ts` (#1055). The schema is imported from `platform-config-lib` — the\n * single source — rather than re-declared here.\n *\n * This schema is STRICT, which is why it is the fourth place a new infra field has to be added and\n * not the third: the input schema, the `defineInfraEnvConfig` transform and the `config.json`\n * builder all carry it, and a key none of them agreed on fails the parse here. That is the good\n * failure — the one this section is guarding against is the opposite, a field written by the builder\n * and silently dropped because nothing declared it.\n */\n systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),\n platformStorage: WildoPlatformStorageConfigSchema.optional(),\n /** Where the platform keeps the keys it holds for applications (`WildoInfraEnvConfig.platformKeyManagement`, #2933). */\n platformKeyManagement: WildoPlatformKeyManagementConfigSchema.optional(),\n kubernetes: WildoKubernetesConfigSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.optional(),\n /**\n * The application whose infrastructure this environment runs on, when it is HOSTED\n * (`WildoInfraEnvConfig.infrastructureHost`, resolved: absolute paths). Absent means this application OWNS\n * its infrastructure. Every CLI action on SHARED infrastructure reads it — through\n * `EnvironmentRegistry.resolveInfrastructureHost` / `InfrastructureHost.resolve` — and leaves that action to the host.\n */\n infrastructureHost: z.strictObject({\n applicationRoot: z.string().min(1),\n infraConfigPath: z.string().min(1),\n }).optional(),\n atlas: z.object({\n apiBaseUrl: z.string(),\n projectId: z.string(),\n clusterName: z.string(),\n }).optional(),\n externalServices: z\n .object({\n mongodb: z.object({ provider: z.string() }),\n valkey: z.object({ provider: z.string() }).optional(),\n storage: z.object({ provider: z.string() }),\n rabbitmq: z.object({ provider: z.string() }),\n /**\n * Optional ClamAV external-service binding (managed antivirus\n * scanner). Slice 6 / F-20: typed `host`/`port`/`tls` so the\n * validate path no longer needs an untyped cast and a downstream\n * wiring change cannot bypass schema enforcement.\n */\n clamav: ClamavExternalServiceSchema.optional(),\n })\n .optional(),\n /**\n * STRICT on purpose (5.3 review): this object is hand-edit-only for most slots (the wizard\n * authors only the Atlas mongodb entry), and every consumer does a direct property read — so a\n * typo key (`postgres`, `postgresQL`) used to be silently STRIPPED and degrade into an\n * empty-connection boot failure three layers from the misspelling. Rejecting unknown keys turns\n * the typo into a named parse error at the file that contains it.\n */\n externalEndpoints: z\n .strictObject({\n mongodb: z.object({ connectionUrl: z.string() }).optional(),\n /**\n * MANAGED PostgreSQL platform endpoint (RDS/Neon/Cloud SQL…) — the PG mirror of the\n * `mongodb.connectionUrl` slot above. Read by `emitPlatformPostgresEnv` when the platform's\n * `database.engine === POSTGRESQL` with `source: MANAGED`; a full URL for the same reason\n * Atlas is (an external endpoint's address, credentials and TLS posture arrive as one\n * opaque value the environment cannot derive).\n */\n postgresql: z.object({ connectionUrl: z.string() }).optional(),\n valkey: z.object({ host: z.string(), port: z.number() }).optional(),\n rabbitmq: z.object({ host: z.string(), port: z.number() }).optional(),\n storage: z.object({ endpoint: z.string(), port: z.number() }).optional(),\n })\n .optional(),\n}).superRefine((config, ctx) => {\n if (config.type === WildoLocationType.REMOTE && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: \"custom\",\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.kubernetes\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['kubernetes'],\n message: 'kubernetes config is required for remote Kubernetes environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.remoteProvider\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (config.externalEndpoints?.storage) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalEndpoints', 'storage'],\n message: 'externalEndpoints.storage is not supported yet; only managed MinIO wiring is currently supported',\n });\n }\n if (\n config.externalServices?.storage\n && config.externalServices.storage.provider !== 'minio'\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalServices', 'storage'],\n message: 'externalServices.storage must use provider \"minio\"; only managed MinIO wiring is currently supported',\n });\n }\n});\nexport type PlatformEnvConfigJson = z.infer<typeof PlatformEnvConfigJson_Schema>;\n\n/**\n * Generated `application-runtime-identity.json` — a per-env record mapping an\n * app slug to its apps-manager-minted `APPLICATION_ID` (a Mongo `_id`, NOT\n * derivable offline from the slug).\n *\n * Written by the credential-fetching bootstrap flows (see\n * `AppBootstrapService.prepareApplicationEnvTargets`) so a degraded regeneration\n * can rebuild bootstrap credentials OFFLINE (`reconstructBootstrapCredentialsOffline`)\n * without re-contacting apps-manager. The compose render stopped reading it in\n * #2955, when each minion and worker began mounting its own env file.\n *\n * Kept OUT of `config.json` on purpose: `config.json`\n * ({@link PlatformEnvConfigJson}) is the app-agnostic PLATFORM infra config,\n * whereas this is app-runtime IDENTITY. Keyed by slug so multiple apps sharing\n * one env-scope each resolve their own id.\n */\nexport const ApplicationRuntimeIdentityJson_Schema = z.record(\n z.string().min(1),\n z.object({ applicationId: z.string().min(1) }),\n);\nexport type ApplicationRuntimeIdentityJson = z.infer<typeof ApplicationRuntimeIdentityJson_Schema>;\n"]}
|
|
1
|
+
{"version":3,"file":"credentials.schemas.js","sourceRoot":"","sources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GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC;YACtC,OAAO,EAAE,kGAAkG;SAC5G,CAAC,CAAC;IACL,CAAC;IACD,IACE,MAAM,CAAC,gBAAgB,EAAE,OAAO;WAC7B,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,EACvD,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;YACrC,OAAO,EAAE,sGAAsG;SAChH,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EACjB,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C,CAAC","sourcesContent":["// Boundary adapter: Zod schemas validate user-facing files (secrets.json, config.json)\n// against domain enums. This import direction (validation → domain types) is intentional.\nimport z from \"zod\";\nimport {\n APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n ApplicationCreationVerificationConfigSchema,\n BackingServicesEnvConfigSchema,\n BackingServiceSource,\n WildoCdnConfigSchema,\n WildoSystemsOfRecordEnvConfigSchema,\n WildoPlatformStorageConfigSchema,\n WildoPlatformKeyManagementConfigSchema,\n DatabaseEngine,\n PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n WildoAuthConfigSchema,\n WildoDeploymentRuntime,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLocalDataStorage,\n EnvironmentServiceProfile,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoProviderSelectionOverridesSchema,\n WildoInfraEmailConfigSchema,\n WildoOwnershipDnsStandInConfigSchema,\n WildoRemoteProviderSchema,\n} from '@wildo-ai/platform-config-lib';\nimport { EnvironmentAgentContentGuardrailsSchema, RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { PROVIDER_SENSITIVE_ENV_KEYS } from '~wildo-cli/services/credentials/provider-env-vars.utils';\nimport { LiveEnvKeySet, memoiseOverCatalogue } from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\n\n// ============================================================================\n// Default credential usernames (not secrets — safe to store as constants)\n// ============================================================================\n\n// ---------------------------------------------------------------------------\n// Credential input types (shared between modules and services)\n// ---------------------------------------------------------------------------\n\nexport interface AdminUserInput {\n email: string;\n firstName: string;\n lastName: string;\n /**\n * Optional operator-supplied initial password.\n *\n * When `undefined`, the secrets writer auto-generates a 16-char password\n * (preserving the historical zero-friction local-setup UX where the\n * generated password is printed at the end of `wildo setup`).\n *\n * When provided (today only via the `WILDO_INIT_ADMIN_PASSWORD` env-var\n * seed in {@link platformAdminUserModule}), the explicit value is\n * threaded into `Wildo_Application_Secrets.admin.password` and reused\n * by every downstream consumer (`secrets-writer`, `env-vars-builder`,\n * `k8s-bootstrap`, `app-bootstrap.service`). This is the single\n * non-interactive entry-point for CI flows that need a deterministic\n * admin password.\n */\n password?: string;\n}\n\n/**\n * CLI-namespaced env-var contract for non-interactive / CI-driven seeding\n * of the platform admin identity collected by `wildo setup` and by\n * `wildo init`, which mints the application's own `local` secrets.json\n * (issue #155) and reads these same seeds when no `--admin-*` flag is given.\n *\n * Why a CLI-specific namespace (`WILDO_INIT_ADMIN_*`) instead of reusing\n * the apps-manager runtime contract (`ADMIN_EMAIL` / `ADMIN_PASSWORD` /\n * `ADMIN_FIRST_NAME` / `ADMIN_LAST_NAME`):\n *\n * - The apps-manager keys describe the **running platform process's**\n * admin user (consumed by `init-mode-startup.apps-manager.service.ts`\n * in INIT mode) — they are runtime config for a long-lived service.\n *\n * - These keys describe the **operator running the CLI scaffold** —\n * one-shot input for the local setup wizard. Conflating them risks\n * accidentally seeding a CI runner's apps-manager process with the\n * developer's personal credentials (or vice-versa).\n *\n * Contract semantics (per Slice 2 / 2.3 design decision, TARGETED scope):\n * - Email / first name / last name: env value, when present, is used as\n * the prompt default. The operator can still override interactively.\n * - Password: env value, when present, is threaded directly into\n * `AdminUserInput.password` (skipping the auto-generator). When\n * absent, the secrets writer auto-generates a 16-char password — this\n * preserves the historical UX and is intentional.\n */\nexport enum WildoCliInitAdminEnvKeys {\n WILDO_INIT_ADMIN_EMAIL = 'WILDO_INIT_ADMIN_EMAIL',\n WILDO_INIT_ADMIN_FIRSTNAME = 'WILDO_INIT_ADMIN_FIRSTNAME',\n WILDO_INIT_ADMIN_LASTNAME = 'WILDO_INIT_ADMIN_LASTNAME',\n WILDO_INIT_ADMIN_PASSWORD = 'WILDO_INIT_ADMIN_PASSWORD',\n}\n\n/**\n * The same one-shot CLI contract, for the SECOND administrator (#575).\n *\n * A separate enum rather than four more members on {@link WildoCliInitAdminEnvKeys}, because the two\n * identities have different provenance rules and a shared enum would hide that. The admin's fields\n * are always operator-authored; the approver's are operator-authored on a REMOTE environment and\n * DERIVED from the admin on a local one. Reading them from one vocabulary invites a caller to treat\n * a derived value and a stated one as interchangeable, which is the whole distinction\n * {@link resolveApproverIdentity} exists to keep.\n *\n * Unlike the admin keys the PASSWORD is not optional-with-a-generator here: locally the approver\n * shares the admin's password by construction, and remotely a generated password nobody was told\n * about would produce an approver who cannot sign in — an account that exists and cannot act is\n * worse than a refusal, because the refusal is the part that gets fixed.\n */\nexport enum WildoCliInitApproverEnvKeys {\n WILDO_INIT_APPROVER_EMAIL = 'WILDO_INIT_APPROVER_EMAIL',\n WILDO_INIT_APPROVER_FIRSTNAME = 'WILDO_INIT_APPROVER_FIRSTNAME',\n WILDO_INIT_APPROVER_LASTNAME = 'WILDO_INIT_APPROVER_LASTNAME',\n WILDO_INIT_APPROVER_PASSWORD = 'WILDO_INIT_APPROVER_PASSWORD',\n}\n\nexport interface ProviderKeysInput {\n /**\n * Provider secrets keyed by their exact env-var name (e.g. `OPENAI_API_KEY`,\n * `STRIPE_SECRET_KEY`), collected in the interactive `wildo setup` flow from\n * the registry-derived provider selection. This is the single map for ALL\n * provider secrets — there are no per-provider convenience fields; the setup\n * UX and the backend registry both address providers by env-var name.\n */\n providerEnv?: Record<string, string>;\n /**\n * GitHub ORGANIZATION integration (source-control), distinct from the GitHub\n * OAuth2 provider secret: these feed the `github` block of `secrets.json`,\n * not `providerEnv`.\n */\n githubOrgUrl?: string;\n githubAdminUser?: string;\n githubAdminToken?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Default credential usernames (not secrets — safe to store as constants)\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_PLATFORM_ENV_INTERNAL_SERVICE_CREDENTIAL_USERNAME = {\n MONGODB_ROOT_USER: 'wildo',\n VALKEY_ADMIN_USER: 'default',\n PG_ADMIN_USER: 'wildo_admin',\n RABBITMQ_ADMIN_USERNAME: 'wildo',\n MINIO_ACCESS_KEY: 'wildo',\n} as const;\n\n\n// ============================================================================\n// Sensitive env var classification\n// ============================================================================\n\n/**\n * Env var keys classified as sensitive (credentials, passwords, API keys).\n * Used to separate secret values from plain-text config when generating\n * deployment artifacts (K8s Secret vs ConfigMap, Docker env_file, etc.).\n *\n * Infrastructure keys are listed explicitly. Provider credentials come from the COMPOSED\n * provider catalogue via `PROVIDER_SENSITIVE_ENV_KEYS` — engine tier plus every provider\n * package discovery has registered.\n *\n * A LIVE view rather than a `new Set([...])` snapshot, and the difference is load-bearing\n * (#329): this module is evaluated on the CLI's first touch of the credential layer, which is\n * always before an application's provider packages have been discovered. A snapshot would have\n * frozen the answer at \"engine providers only\", so a package-shipped provider's API key would\n * have been classified as plain config and written into a Kubernetes `ConfigMap`. The static\n * halves are still snapshotted — they are compile-time constants and cannot move.\n */\nconst STATIC_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new Set([\n // Shared platform runtime env contract secrets\n ...PLATFORM_RUNTIME_SENSITIVE_ENV_KEYS,\n // Shared app-backend env contract secrets\n ...APPLICATION_BACKEND_SENSITIVE_ENV_KEYS,\n]);\n\nexport const SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(\n // Memoised against the composition generation rather than rebuilt per `.has()`: the K8s secrets\n // generator asks this once per environment variable, and the union is only ever invalidated by a\n // registration.\n memoiseOverCatalogue(() => new Set([...STATIC_SENSITIVE_ENV_KEYS, ...PROVIDER_SENSITIVE_ENV_KEYS])),\n);\n\n// ============================================================================\n// Zod schemas for secrets.json and config.json (CLI validation)\n// ============================================================================\n\nexport const PlatformEnvSecretsJson_Schema = z\n .object({\n mongodb: z.object({\n rootUser: z.string(),\n rootPassword: z.string(),\n }).optional(),\n valkey: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }).optional(),\n postgresql: z.object({\n adminUser: z.string(),\n adminPassword: z.string(),\n }),\n rabbitmq: z.object({\n adminUsername: z.string(),\n adminPassword: z.string(),\n erlangCookie: z.string(),\n }),\n storage: z.object({\n accessKey: z.string(),\n secretKey: z.string(),\n }),\n platform: z.object({\n primarySecret: z.string(),\n /** Dedicated shared secret for admin operations (CLI ↔ apps-manager). */\n adminSecret: z.string(),\n appsManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }),\n /**\n * The crontabs-batches-manager's dedicated P2P signing keypair (per-service, mirrors\n * `appsManager`). Private half → crontabs (signs every SCHEDULED_CRON / MINION_TICK job\n * token); public half → apps-manager, which distributes it into each app's\n * `PLATFORM_CRONTABS_BATCHES_MANAGER` verify slot. Declared in\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` and therefore minted both at setup and by the\n * idempotent provisioning self-heal (`wildo local dev` / `wildo local up` preflight,\n * `wildo config sync`), so an environment predating the keypair acquires it on the\n * next command. `.optional()` at the schema layer (mirrors `immudb`) so a secrets.json\n * predating this fix still PARSES — but unlike immudb there is NO graceful degradation:\n * the crontabs config + apps-manager distribution FAIL-LOUD when it is absent (a missing\n * key silently dead-lettered every scheduled tick before this fix).\n */\n crontabsBatchesManager: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n }).optional(),\n /**\n * apps-manager's response keys (#2921), current and next. The current private half → apps-manager\n * (`PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY`); both public halves → every application runtime\n * (`PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS`). Declared in `FRAMEWORK_MANAGED_SECRET_MATERIALS`, so the\n * provisioning self-heal mints it on an environment that predates it. `.optional()` so such a secrets.json still\n * parses; the environment builders FAIL LOUD when it is absent, because apps-manager may not answer unsigned.\n */\n appsManagerResponseSigning: z.object({\n privateKey: z.string(),\n publicKey: z.string(),\n nextPrivateKey: z.string(),\n nextPublicKey: z.string(),\n }).optional(),\n /**\n * The platform's key-encryption root (#2891): apps-manager seals every LOCAL private key under `current`.\n * `previous` exists only between a rotation and the re-seal that retires it. → `PLATFORM_KEY_ENCRYPTION_ROOT` /\n * `PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT`, apps-manager only. `.optional()` so a secrets.json that predates it\n * still parses; the self-heal mints it and the apps-manager builder fails loud without it.\n */\n keyEncryptionRoot: z.object({\n current: z.string(),\n previous: z.string().optional(),\n }).optional(),\n }),\n /**\n * The APPLICATION's own operator secret — distinct from `platform` above, which is the\n * PLATFORM's, and which an application must never hold.\n *\n * One field, and a section of its own rather than a key under `platform`, because the tier is\n * the whole point: `resolveForbiddenPlatformCredentials` refuses to emit any platform-tier\n * credential into an application-tier env, and this value must go INTO that env. Filing it\n * under `platform` would have made it unemittable by the very guard that protects the boundary.\n *\n * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`\n * written before this existed must still PARSE. Unlike an identity it IS mintable, so it is\n * declared in `FRAMEWORK_MANAGED_SECRET_MATERIALS` and the idempotent self-heal fills it on the\n * next command — an environment predating it acquires one without an operator typing anything.\n */\n application: z.object({\n /**\n * Gates the data-seeding and external-data admin surfaces. 48 bytes, minted, rotatable.\n *\n * MINTED rather than operator-authored, and the trade is worth stating. The external-data\n * controller's header defends an unset default — *\"so a fresh deployment never accidentally\n * exposes a door that reaches a third party's production system\"* — and that reasoning was\n * written when there was NO channel to author it, so \"unset\" was the only reachable state.\n * With a channel, the choice is between a door nobody can open and a door behind 48 bytes of\n * entropy. The direct analogue one tier up settles it: `platform.adminSecret` is minted at the\n * same length for the same kind of surface. Reversible — remove this from the materials\n * registry and absent-by-default returns, since every consumer already answers 503 on absence.\n */\n adminSecret: z.string(),\n }).optional(),\n admin: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }),\n /**\n * The SECOND platform administrator — the one who approves an application-wide access grant.\n *\n * Not a nicety. `applicationAccessGrantApproverIsDistinct` refuses `operator === approver` and\n * refuses an ABSENT approver, and the application-scoped grant has deliberately no\n * auto-approval branch — the schema states why: this grant names no tenant, so *\"a grant that\n * could approve itself would make the two-person rule ceremonial\"*. A deployment with one\n * administrator therefore cannot use the widest read the system offers, at all. The refusal was\n * built and the party who discharges it never was (#575).\n *\n * `.optional()` for the reason `crontabsBatchesManager` and `immudb` are: a `secrets.json`\n * written before this existed must still PARSE. Unlike a generated keypair it cannot be\n * self-healed into place, because an identity is not mintable — see the note on\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS`' `ADMIN_PASSWORD` material, which is careful to declare\n * only the password so that provisioning never invents an admin identity. An environment\n * predating this acquires an approver by re-running setup, or by authoring the block.\n *\n * Locally this is DERIVED from `admin` (see `resolveApproverIdentity`) and shares its password,\n * which makes the two-person rule ceremonial there — deliberately, because the alternative is a\n * developer who cannot exercise an application-wide read at all. That is exactly why a\n * non-local environment gets no derivation and must state the approver itself.\n */\n approver: z.object({\n email: z.string(),\n password: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n }).optional(),\n atlas: z.object({\n apiPublicKey: z.string(),\n apiPrivateKey: z.string(),\n }).optional(),\n /**\n * immudb state-signing keypair — the cryptographic whole-server-substitution defense\n * for the tamper-evident audit store (`COMPLIANCE_AUDIT_TRAIL`). Auto-generated (ECDSA\n * P-256) from the `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry — at setup for a new\n * environment, and by the idempotent provisioning self-heal for an existing one; the two\n * halves flow to DIFFERENT places and MUST NOT be conflated:\n *\n * - `stateSigningPrivateKey` (SEC1 \"EC PRIVATE KEY\" PEM) — mounted into the SELF-hosted\n * immudb server (`--signingKey`, immudb `x509.ParseECPrivateKey`) so it signs its\n * `ImmutableState`. SERVER-side ONLY: rides the k8s `immudb-secret` / the compose\n * local-data key file. NEVER injected into `providerEnv` or any app-pod env.\n * - `stateSigningPublicKey` (SPKI PEM) — pinned by the audit client via the\n * `IMMUDB_STATE_PUBLIC_KEY` provider secret; the client verifies the server's signed\n * state against it (immudb-verified-kv-client `verifyImmutableStateSignature`). A\n * substituted immudb cannot forge the signature without the private key, so substitution\n * is cryptographically caught. Public material — safe to deliver to every app runtime.\n *\n * Optional at the schema layer (mirrors mongodb/valkey): a secrets.json that lacks it\n * still validates, and immudb then runs UNSIGNED (client warns \"signing OFF\") — graceful\n * degradation, not a hard failure. That path now only survives for a CI-reconstructed\n * secrets.json (`reconstructSecretsFromEnv`, which publishes no immudb material); a\n * file-backed environment is provisioned automatically on the next CLI command.\n */\n immudb: z.object({\n stateSigningPrivateKey: z.string(),\n stateSigningPublicKey: z.string(),\n /**\n * #1696 — the self-hosted immudb server's built-in `immudb` SYSADMIN password, a PLATFORM secret. The\n * server is initialised with it (compose `IMMUDB_ADMIN_PASSWORD`, the k8s `immudb-secret`), and\n * apps-manager — the only runtime that receives it (`IMMUDB_ADMIN_PASSWORD` in its env) — logs in with it\n * to give each application its OWN database and its OWN `READ_WRITE` user. No application holds it.\n *\n * Until #1696 the server's admin password was COPIED from the owning application's operator-authored\n * `providerEnv.IMMUDB_PASSWORD`, which is also the credential every application's audit sink logged in\n * with — so every hosted application held the sysadmin of every application's audit data. Minted here,\n * it is no application's value.\n *\n * Its own material (`IMMUDB_ADMIN_PASSWORD`) rather than a third key on the state-signing keypair, so an\n * environment that predates it acquires only this key and its keypair is never re-minted. `.optional()` so\n * a `secrets.json` written before it still parses; the self-heal fills it on the next CLI command.\n */\n adminPassword: z.string().optional(),\n }).optional(),\n /**\n * Issue #74 — the SCRAM password `mongot` authenticates to mongod with, as a\n * `searchCoordinator`-roled user in mongod's `admin` database. Auto-generated from the\n * `FRAMEWORK_MANAGED_SECRET_MATERIALS` registry.\n *\n * Only the password lives here. The USERNAME is a framework-owned service identity\n * (`MONGOT_SYNC_SOURCE.USERNAME`), so it is a code constant rather than a stored value —\n * storing it would create a second place a rename has to reach.\n *\n * Both deployment lanes read THIS one value, which is the point: mongot never receives a\n * password directly, it reads a FILE, and the user it authenticates as is created by the\n * `mongodb-init` step. Three consumers of one secret is exactly the shape that drifts if\n * each lane mints its own — the immudb admin password was that defect one datastore over\n * (contract stated, k8s lane implemented, compose lane silently on the packaged default).\n *\n * `.optional()` mirrors mongodb/valkey/immudb so a secrets.json predating this parses; a\n * file-backed environment acquires it on the next self-heal, and an environment that\n * self-hosts no mongod never needs it.\n */\n mongot: z.object({\n syncSourcePassword: z.string(),\n }).optional(),\n /**\n * #2933 — the self-hosted OpenBao that holds the platform's custodied keys (`platformKeyManagement.vault.source ===\n * 'self'`). Framework-managed: the static unseal key and the ids of apps-manager's two tokens and of the recovery\n * token, which the server creates at its first start. None is rotated by `--rotate-secrets` (see the materials); the\n * break-glass verbs `wildo keys vault-rotate-tokens` and `vault-rotate-unseal-key` move them on the running server. Only the OpenBao\n * container and apps-manager receive any of it; no application does. `.optional()` so a `secrets.json` written\n * before it parses; the self-heal fills it on the next CLI command.\n */\n platformKeyVault: z.object({\n unsealKey: z.string(),\n signerToken: z.string(),\n operatorToken: z.string(),\n /**\n * #3006 — the break-glass RECOVERY token's id: the server issues it at its first start, and only\n * `wildo keys vault-rotate-tokens` / `vault-rotate-unseal-key` read it. The OpenBao container receives it (read\n * once, at that first start); apps-manager and every runtime never do (the env builder forbids it). Optional so a\n * section written before #3006 parses; the self-heal mints it, and a server initialized before then never knew it.\n */\n recoveryToken: z.string().optional(),\n /**\n * #3006 — set only between the two steps of `wildo keys vault-rotate-unseal-key`: the key the server's storage may\n * still be wrapped under. Rendered as the static seal's `previous_key`; dropped once the root key is re-wrapped.\n */\n previousUnsealKey: z.string().optional(),\n }).optional(),\n /**\n * #2933 — the two tokens for the operator's OWN Vault (`platformKeyManagement.vault.source === 'managed'`),\n * issued by the operator under the signer and operator policies the key-management contracts state. Operator-typed,\n * like `atlas`: the framework never generates, rotates or renews them here (apps-manager renews them at runtime).\n */\n platformKeyVaultManaged: z.object({\n signerToken: z.string().min(1),\n operatorToken: z.string().min(1),\n }).optional(),\n /**\n * #2934 — the user PIN of the platform's PKCS#11 token (`platformKeyManagement.pkcs11`). Operator-typed, like the\n * managed Vault's tokens: the HSM's owner sets it, and the framework never generates or rotates it.\n */\n platformKeyPkcs11: z.object({\n pin: z.string().min(1),\n }).optional(),\n /**\n * Protocol-aware provider credentials keyed by the actual process env var\n * name that should be injected into runtime services.\n */\n providerEnv: z.record(z.string(), z.string()).optional(),\n /**\n * System-of-record credentials, keyed by the DERIVED environment-variable name\n * (`WILDO_SOR_<NAME>__<SLOT>`, #1055).\n *\n * ## Why it is flat, and not a tree keyed by instance (R5)\n *\n * A per-instance tree would be the obvious shape and it breaks two mechanisms. The CI secret\n * reconstruction walks a STATIC table of secret paths, and `isOptionalSecretPath` THROWS on a\n * `z.record` node — so an instance-keyed section listed there crashes `wildo config sync --domain\n * cicd`. And `envVarSuffixForSecretPath` is not injective, so two instances of one vendor would\n * collapse onto one CI input. Flat-by-variable-name is the shape `providerEnv` already uses for\n * the same reason, and per-instance structure is recovered by PARSING the key — which the `__`\n * delimiter makes unambiguous.\n *\n * ## Why it is not `providerEnv` itself\n *\n * That map is attributed to a PROVIDER's secrets contract by `filterProviderEnvToScope`, and a\n * system of record is deliberately not a provider (D10). Sharing the map would make every\n * instance's credential look like a provider key to the scoping logic — and be silently dropped by\n * it once the vendor leaves `providers.scopes`.\n *\n * ## Why it must be DECLARED here at all\n *\n * `wildo config sync --rotate-secrets` and `wildo setup` re-write `secrets.json` THROUGH this\n * schema. An undeclared section is not preserved — it is deleted. Declaring it is the whole\n * mechanism that stops an operator's ERP credentials disappearing on the next rotation; rotation\n * itself never touches the section, because it is registry-driven and these are not\n * framework-managed secrets.\n */\n systemsOfRecordEnv: z.record(z.string(), z.string()).optional(),\n /**\n * Verification secrets of the application's INBOUND endpoints (`POST /webhooks/app/{endpointKey}`,\n * #1596), keyed by the DERIVED variable name `WILDO_INBOUND_<ENDPOINT_KEY>__SECRET`\n * (`deriveInboundEndpointSecretEnvVarName` in `@wildo-ai/saas-models`).\n *\n * Flat and keyed by variable name for the reasons `systemsOfRecordEnv` gives above: the key space is\n * open (one key per endpoint the application declares) and the endpoint is recovered by parsing the\n * name. Not `providerEnv`, because an inbound endpoint is the application's own and not a provider's,\n * so `filterProviderEnvToScope` would drop it.\n *\n * Delivered to the application BACKEND only — the one runtime that mounts the endpoint — and stripped\n * from every minion, which would otherwise hold a signing secret it cannot use. Rotation leaves it\n * alone: the SENDER holds the same secret, so changing it here alone breaks every delivery.\n */\n inboundEndpointEnv: z.record(z.string(), z.string()).optional(),\n github: z.object({\n orgUrl: z.string().optional(),\n adminUser: z.string().optional(),\n adminToken: z.string().optional(),\n }).optional(),\n });\nexport type PlatformEnvSecretsJson = z.infer<typeof PlatformEnvSecretsJson_Schema>;\n\n/**\n * Who a credential belongs to when several applications share one environment's infrastructure.\n *\n * An application HOSTED on another's infrastructure (`infrastructureHost`) reads every shared credential\n * from its host's `secrets.json` and keeps only its own in its file — so there is exactly one copy of a\n * shared credential, held by the one application that runs the thing it opens.\n */\nexport enum SecretOwner {\n /**\n * The identity of a shared container or platform service: backing-service admin credentials, the\n * platform's secrets and signing keypairs, the immudb and mongot material, the platform's Atlas and\n * GitHub access. Held by the infrastructure host only.\n */\n SHARED_INFRASTRUCTURE = 'shared-infrastructure',\n /**\n * Material only this application uses: its own operator-door secret, its provider API keys, and the\n * administrator and approver identities its registration seeds as its first users.\n */\n APPLICATION = 'application',\n}\n\n/**\n * Owner of every top-level `secrets.json` section. Total over the schema by type, so a section added\n * tomorrow does not compile until somebody decides whether a hosted application may hold its own copy.\n *\n * `admin` and `approver` are APPLICATION although the platform's own INIT also reads them: a hosted\n * application never runs platform INIT (that is its host's), and the only thing it does with them is\n * seed its OWN first administrator and approver at registration.\n */\nexport const SECRETS_SECTION_OWNERSHIP: Readonly<Record<keyof PlatformEnvSecretsJson, SecretOwner>> = {\n mongodb: SecretOwner.SHARED_INFRASTRUCTURE,\n valkey: SecretOwner.SHARED_INFRASTRUCTURE,\n postgresql: SecretOwner.SHARED_INFRASTRUCTURE,\n rabbitmq: SecretOwner.SHARED_INFRASTRUCTURE,\n storage: SecretOwner.SHARED_INFRASTRUCTURE,\n platform: SecretOwner.SHARED_INFRASTRUCTURE,\n application: SecretOwner.APPLICATION,\n admin: SecretOwner.APPLICATION,\n approver: SecretOwner.APPLICATION,\n atlas: SecretOwner.SHARED_INFRASTRUCTURE,\n immudb: SecretOwner.SHARED_INFRASTRUCTURE,\n mongot: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyVault: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyVaultManaged: SecretOwner.SHARED_INFRASTRUCTURE,\n platformKeyPkcs11: SecretOwner.SHARED_INFRASTRUCTURE,\n providerEnv: SecretOwner.APPLICATION,\n /*\n * APPLICATION. These are the credentials for the external systems THIS application reads from, keyed by the\n * instance names its own saas config declares. A hosted application authors its own systems of record (or\n * `{ enabled: false }`), so inheriting its host's would hand it a credential to somebody else's ERP.\n */\n systemsOfRecordEnv: SecretOwner.APPLICATION,\n /* APPLICATION: the secrets of endpoints THIS application's own handlers declare, agreed with its own senders. */\n inboundEndpointEnv: SecretOwner.APPLICATION,\n github: SecretOwner.SHARED_INFRASTRUCTURE,\n};\n\n/**\n * The sections of `secrets` a hosted application holds itself — everything else is its host's. Absent\n * sections stay absent; nothing is defaulted.\n */\nexport function projectApplicationOwnedSecrets(secrets: Partial<PlatformEnvSecretsJson>): Partial<PlatformEnvSecretsJson> {\n const projected: Record<string, unknown> = {};\n for (const [section, owner] of Object.entries(SECRETS_SECTION_OWNERSHIP)) {\n const value = (secrets as Record<string, unknown>)[section];\n if (owner === SecretOwner.APPLICATION && value !== undefined) {\n projected[section] = value;\n }\n }\n return projected as Partial<PlatformEnvSecretsJson>;\n}\n\nconst PlatformEnvStorageConfig_Schema = z.object({\n provider: z.enum(['minio']),\n useSsl: z.boolean(),\n bucket: z.string(),\n});\n\nconst PlatformEnvPostgresqlConfig_Schema = z.object({\n database: z.string(),\n sslMode: z.string(),\n});\n\n/**\n * Slice 6 / F-20 — typed external-service binding for ClamAV (managed\n * antivirus scanner): the validate command reads `host` through this\n * schema, so a typo at the persisted-config layer fails at parse time.\n */\nexport const ClamavExternalServiceSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().positive().optional(),\n tls: z.boolean().optional(),\n});\nexport type ClamavExternalServiceConfig = z.infer<typeof ClamavExternalServiceSchema>;\n\n/**\n * Slice 3 deep-review H-1 (2026-04-13): use `z.strictObject` (not `z.object`)\n * at the root so that unknown top-level keys in a persisted\n * `environments/<env>/config.json` fail-closed at parse time instead of\n * being silently stripped. Today the loader (`environment-registry.service`)\n * uses `safeParse` and treats a parse failure as a cache miss, so this\n * change does not crash the CLI at boot — but it does ensure that\n * `wildo config validate` (which calls `parse`) catches a typoed root key\n * as a hard error, matching the strict posture of `WildoSaasConfigSchema`.\n */\nexport const PlatformEnvConfigJson_Schema = z.strictObject({\n type: z.enum(WildoLocationType),\n runtime: z.enum(WildoDeploymentRuntime),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n /**\n * Where this environment's self-hosted backing services keep their data — a Docker named volume\n * or a host bind mount under `local_data/<service>/`.\n *\n * `.optional()` because this is a STRICT schema read back from a `config.json` written before the\n * field existed, and a parse failure is treated as a cache miss that silently discards the whole\n * record. Absence is read through `resolveLocalDataStorage`, which derives it from `locationType`\n * — so an environment provisioned before this field keeps a correct answer rather than an empty\n * one, and does not have to be re-synced to get it.\n */\n localDataStorage: z.enum(WildoLocalDataStorage).optional(),\n /**\n * The environment's service profile (#2303), projected from the descriptor. Optional for the same reason as\n * `localDataStorage`: a `config.json` written before the field existed must still parse, and absence reads as\n * `FULL` (`DEFAULT_ENVIRONMENT_SERVICE_PROFILE`), which is what that environment has always run.\n */\n serviceProfile: z.enum(EnvironmentServiceProfile).optional(),\n database: z.object({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Slice 4.B.0 (2026-05-07): managed-brand identifier when\n * `source === MANAGED`. For Mongo: `'atlas'`. For Postgres:\n * one of `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' |\n * 'supabase' | 'neon' | 'render'`. Generalized from the\n * pre-reshape source-only model where `'atlas'` was a `source`\n * value.\n */\n provider: z.string().min(1).optional(),\n }),\n /**\n * Which declared backing store the APPLICATION's own resources persist to — mirrored from the\n * authored `applicationDatabase` in `wildo.infra.<env>.config.ts`.\n *\n * Distinct from `database` directly above, which is the PLATFORM's engine. The two move\n * independently: a PostgreSQL platform can host a MongoDB application and vice versa.\n *\n * Written RESOLVED by the current CLI (absence in the infra config means PostgreSQL, #1571). OPTIONAL\n * only so an older `config.json` still parses; a reader of an absent value resolves it through\n * `resolveApplicationDatabaseEngine`, never through a default of its own.\n */\n applicationDatabase: z.object({\n engine: z.enum(DatabaseEngine),\n }).optional(),\n infrastructure: z.object({\n storage: PlatformEnvStorageConfig_Schema,\n postgresql: PlatformEnvPostgresqlConfig_Schema,\n }),\n /**\n * Authored backing-services snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. Carries per-service overrides\n * (host/port/name/vhost/endpoint/bucket/database) that the\n * `ServiceAddressResolver`, docker-compose generator, and env-vars-builder\n * use to honor the author's intent. When omitted (legacy generated\n * configs), all consumers fall back to catalog defaults.\n *\n * Persisted shape matches the author shape 1:1 — the canonical contract\n * lives in `BackingServicesEnvConfigSchema` so a future CLI run that\n * re-syncs from infra config produces a stable JSON snapshot.\n */\n backingServices: BackingServicesEnvConfigSchema.optional(),\n /**\n * Authored `serviceAuth` policy snapshot, mirrored from the parsed\n * `wildo.infra.<env>.config.ts`. This is the SOURCE OF TRUTH for\n * platform-managed JWT TTLs (`accessTokenExpirationMinutes` /\n * `refreshTokenExpirationDays`) seeded into every `Wildo_Application_Config`\n * at apps-manager init time. Authored value > schema default (15 / 30).\n * When the field is absent at parse time, the apps-manager init defaults\n * flow falls back to `WildoAuthConfigSchema.parse({})` so the runtime\n * backend always receives a fully-defined `jwt` block.\n */\n serviceAuth: WildoAuthConfigSchema.optional(),\n /**\n * Authored logging posture snapshot mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 3.5). Persisted so the runtime contract survives a\n * `wildo config sync` cycle: `env-vars-builder` reads it back to emit\n * `LOG_LEVEL` / `LOG_FORMATTED_CONSOLE_ERRORS` for every long-running\n * platform/application process, and `LoggerService.loadConfiguration`\n * consumes the env vars at boot. Missing => LoggerService keeps its\n * built-in defaults (level `debug`, pino-pretty auto-detect by\n * `APPLICATION_ENV`).\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Authored OTLP telemetry posture mirrored from `wildo.infra.<env>.config.ts`\n * (Slice 2 Phase 5). Persisted so `env-vars-builder` can project `OTEL_*` for the\n * `--import` preload across a `wildo config sync` cycle. Missing => telemetry off.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Authored per-environment external-provider SELECTION override mirrored\n * from `wildo.infra.<env>.config.ts` (2026-07-10). Persisted so\n * `env-vars-builder` can project `WILDO_PROVIDER_SELECTION_OVERRIDES` across\n * a `wildo config sync` cycle; `ExternalProvidersRegistryBackendService`\n * reads it at capability-resolution time. Missing => the app-wide\n * `wildo.saas.config.ts` selection applies unchanged.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Authored per-environment email values mirrored from `wildo.infra.<env>.config.ts`. Persisted so\n * `env-vars-builder` can project `WILDO_INBOUND_EMAIL_SHARED_DOMAIN` across a `wildo config sync` cycle. Missing =>\n * the backend configuration's `email.inbound.sharedDomain` applies unchanged.\n */\n email: WildoInfraEmailConfigSchema.optional(),\n /**\n * What this environment does with the agents' classifier-backed content guardrails where no classifier offers them,\n * mirrored from `wildo.infra.<env>.config.ts`. Persisted so `env-vars-builder` can project\n * `WILDO_AGENT_CONTENT_GUARDRAILS` across a `wildo config sync` cycle. Missing => such an agent refuses every turn.\n */\n agentContentGuardrails: EnvironmentAgentContentGuardrailsSchema.optional(),\n /**\n * LOCAL-ONLY ownership-DNS stand-in mirrored from `wildo.infra.local.config.ts` (#2519). Persisted so\n * `env-vars-builder` can project `WILDO_OWNERSHIP_DNS_STAND_IN_URL` across a `wildo config sync` cycle. Missing =>\n * every domain-ownership challenge asks public DNS.\n */\n ownershipDnsStandIn: WildoOwnershipDnsStandInConfigSchema.optional(),\n // No `documentationSite` (#2310): its origins are BUILD inputs of the documentation image, which the image build and\n // the CI workflow read from the authored descriptor. No runtime reads them, so `config.json` does not carry them.\n /**\n * Generated snapshot of the local authored application-creation verification\n * posture. Env generation consumes this snapshot; `.env` is only its sink.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n /**\n * Public domain (`WildoInfraEnvConfig.publicDomain`) — the\n * runtime-agnostic external hostname browsers and reverse proxies\n * resolve. Required at the persisted-config layer because the\n * authored schema requires it; a hand-edited config that drops the\n * field fails Zod parse with a clear error instead of silently\n * defaulting at read time.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public subdomain map (`WildoInfraEnvConfig.serviceHosts`) —\n * mirrored from the authored infra config. `<serviceKey> → subdomain chain`\n * (or `''` for apex) under `publicDomain`. Consumed by the K8s application\n * endpoint builder + ingress generator via `buildServicePublicHost`. Optional\n * — an unauthored key falls back to `<serviceKey>.<publicDomain>`.\n */\n serviceHosts: z.record(z.string().min(1), z.string()).optional(),\n /**\n * Per-service CDN publish config (`WildoInfraEnvConfig.cdn`) — mirrored from\n * the authored infra config. `<serviceKey> → {enabled, bucket?, bucketPrefix?,\n * vendor}`. Reuses the authoritative `WildoCdnConfigSchema` from config-lib\n * (single source of truth — no loose re-declaration). Optional: an unmapped\n * or `enabled: false` service is nginx-pod-served (the default). Consumed by\n * the deploy render (nginx-skip) + `wildo frontend publish`.\n */\n cdn: z.record(z.string().min(1), WildoCdnConfigSchema).optional(),\n /**\n * The platform tier's own bucket, remote-only (`WildoInfraEnvConfig.platformStorage`, #1112). Rendered into the\n * platform services' env through `resolvePlatformObjectStorageBucket`; absent means the fixed platform bucket.\n */\n /**\n * WHERE each declared system of record lives in this environment, mirrored from the authored\n * `wildo.infra.<env>.config.ts` (#1055). The schema is imported from `platform-config-lib` — the\n * single source — rather than re-declared here.\n *\n * This schema is STRICT, which is why it is the fourth place a new infra field has to be added and\n * not the third: the input schema, the `defineInfraEnvConfig` transform and the `config.json`\n * builder all carry it, and a key none of them agreed on fails the parse here. That is the good\n * failure — the one this section is guarding against is the opposite, a field written by the builder\n * and silently dropped because nothing declared it.\n */\n systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),\n platformStorage: WildoPlatformStorageConfigSchema.optional(),\n /** Where the platform keeps the keys it holds for applications (`WildoInfraEnvConfig.platformKeyManagement`, #2933). */\n platformKeyManagement: WildoPlatformKeyManagementConfigSchema.optional(),\n kubernetes: WildoKubernetesConfigSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.optional(),\n /**\n * The application whose infrastructure this environment runs on, when it is HOSTED\n * (`WildoInfraEnvConfig.infrastructureHost`, resolved: absolute paths). Absent means this application OWNS\n * its infrastructure. Every CLI action on SHARED infrastructure reads it — through\n * `EnvironmentRegistry.resolveInfrastructureHost` / `InfrastructureHost.resolve` — and leaves that action to the host.\n */\n infrastructureHost: z.strictObject({\n applicationRoot: z.string().min(1),\n infraConfigPath: z.string().min(1),\n }).optional(),\n atlas: z.object({\n apiBaseUrl: z.string(),\n projectId: z.string(),\n clusterName: z.string(),\n }).optional(),\n externalServices: z\n .object({\n mongodb: z.object({ provider: z.string() }),\n valkey: z.object({ provider: z.string() }).optional(),\n storage: z.object({ provider: z.string() }),\n rabbitmq: z.object({ provider: z.string() }),\n /**\n * Optional ClamAV external-service binding (managed antivirus\n * scanner). Slice 6 / F-20: typed `host`/`port`/`tls` so the\n * validate path no longer needs an untyped cast and a downstream\n * wiring change cannot bypass schema enforcement.\n */\n clamav: ClamavExternalServiceSchema.optional(),\n })\n .optional(),\n /**\n * STRICT on purpose (5.3 review): this object is hand-edit-only for most slots (the wizard\n * authors only the Atlas mongodb entry), and every consumer does a direct property read — so a\n * typo key (`postgres`, `postgresQL`) used to be silently STRIPPED and degrade into an\n * empty-connection boot failure three layers from the misspelling. Rejecting unknown keys turns\n * the typo into a named parse error at the file that contains it.\n */\n externalEndpoints: z\n .strictObject({\n mongodb: z.object({ connectionUrl: z.string() }).optional(),\n /**\n * MANAGED PostgreSQL platform endpoint (RDS/Neon/Cloud SQL…) — the PG mirror of the\n * `mongodb.connectionUrl` slot above. Read by `emitPlatformPostgresEnv` when the platform's\n * `database.engine === POSTGRESQL` with `source: MANAGED`; a full URL for the same reason\n * Atlas is (an external endpoint's address, credentials and TLS posture arrive as one\n * opaque value the environment cannot derive).\n */\n postgresql: z.object({ connectionUrl: z.string() }).optional(),\n valkey: z.object({ host: z.string(), port: z.number() }).optional(),\n rabbitmq: z.object({ host: z.string(), port: z.number() }).optional(),\n storage: z.object({ endpoint: z.string(), port: z.number() }).optional(),\n })\n .optional(),\n}).superRefine((config, ctx) => {\n if (config.type === WildoLocationType.REMOTE && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: \"custom\",\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.kubernetes\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['kubernetes'],\n message: 'kubernetes config is required for remote Kubernetes environments',\n });\n }\n if (\n config.type === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n && !config.remoteProvider\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (config.externalEndpoints?.storage) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalEndpoints', 'storage'],\n message: 'externalEndpoints.storage is not supported yet; only managed MinIO wiring is currently supported',\n });\n }\n if (\n config.externalServices?.storage\n && config.externalServices.storage.provider !== 'minio'\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: ['externalServices', 'storage'],\n message: 'externalServices.storage must use provider \"minio\"; only managed MinIO wiring is currently supported',\n });\n }\n});\nexport type PlatformEnvConfigJson = z.infer<typeof PlatformEnvConfigJson_Schema>;\n\n/**\n * Generated `application-runtime-identity.json` — a per-env record mapping an\n * app slug to its apps-manager-minted `APPLICATION_ID` (a Mongo `_id`, NOT\n * derivable offline from the slug).\n *\n * Written by the credential-fetching bootstrap flows (see\n * `AppBootstrapService.prepareApplicationEnvTargets`) so a degraded regeneration\n * can rebuild bootstrap credentials OFFLINE (`reconstructBootstrapCredentialsOffline`)\n * without re-contacting apps-manager. The compose render stopped reading it in\n * #2955, when each minion and worker began mounting its own env file.\n *\n * Kept OUT of `config.json` on purpose: `config.json`\n * ({@link PlatformEnvConfigJson}) is the app-agnostic PLATFORM infra config,\n * whereas this is app-runtime IDENTITY. Keyed by slug so multiple apps sharing\n * one env-scope each resolve their own id.\n */\nexport const ApplicationRuntimeIdentityJson_Schema = z.record(\n z.string().min(1),\n z.object({ applicationId: z.string().min(1) }),\n);\nexport type ApplicationRuntimeIdentityJson = z.infer<typeof ApplicationRuntimeIdentityJson_Schema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-env-vars.utils.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/provider-env-vars.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AASnH,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oBAAY,wBAAwB;IAClC;;;;OAIG;IACH,2BAA2B,gCAAgC;IAC3D;;;;;OAKG;IACH,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC,2BAA2B,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEnG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,oBAAoB,CAc3F;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,IAAI,oBAAoB,CAEpE;AA6CD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,sBAAsB,EAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3C,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"provider-env-vars.utils.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials/provider-env-vars.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC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AAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,YAAY,EAAE,oBAAoB,CAAC;IACnC,8FAA8F;IAC9F,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,wBAAwB,CA+ExF"}
|
|
@@ -137,7 +137,12 @@ export function getProtocolSecretEnvBindings(providerRef, protocol, configuredPr
|
|
|
137
137
|
const runtimeContract = protocol.runtimeContract;
|
|
138
138
|
switch (runtimeContract.kind) {
|
|
139
139
|
case ProviderProtocolRuntimeKind.LLM:
|
|
140
|
-
|
|
140
|
+
// An arm that signs each request instead (#3780, Amazon Bedrock with IAM credentials) holds its two halves and an
|
|
141
|
+
// optional session token, exactly as a signed document-extraction arm does below.
|
|
142
|
+
pushSecret(runtimeContract.apiKey?.secretRef);
|
|
143
|
+
pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);
|
|
144
|
+
pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);
|
|
145
|
+
pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);
|
|
141
146
|
break;
|
|
142
147
|
case ProviderProtocolRuntimeKind.REST:
|
|
143
148
|
/*
|
|
@@ -154,8 +159,11 @@ export function getProtocolSecretEnvBindings(providerRef, protocol, configuredPr
|
|
|
154
159
|
pushSecret(runtimeContract.apiKey.secretRef);
|
|
155
160
|
break;
|
|
156
161
|
case ProviderProtocolRuntimeKind.EMBEDDINGS:
|
|
157
|
-
// Embeddings transport (RAG drain/retrieval) — same
|
|
158
|
-
pushSecret(runtimeContract.apiKey
|
|
162
|
+
// Embeddings transport (RAG drain/retrieval) — same secret shape as llm, signed arms included (#3780).
|
|
163
|
+
pushSecret(runtimeContract.apiKey?.secretRef);
|
|
164
|
+
pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);
|
|
165
|
+
pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);
|
|
166
|
+
pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);
|
|
159
167
|
break;
|
|
160
168
|
case ProviderProtocolRuntimeKind.DOCUMENT_EXTRACTION:
|
|
161
169
|
// Document-extraction transport (OCR) — same API-key secret shape as llm/image/embeddings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-env-vars.utils.js","sourceRoot":"","sources":["../../../../src/services/credentials/provider-env-vars.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sCAAsC,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAC3H,OAAO,EACL,wBAAwB,EACxB,mCAAmC,EACnC,aAAa,EACb,oBAAoB,GACrB,MAAM,6DAA6D,CAAC;AAUrE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAN,IAAY,wBAcX;AAdD,WAAY,wBAAwB;IAClC;;;;OAIG;IACH,uFAA2D,CAAA;IAC3D;;;;;OAKG;IACH,iDAAqB,CAAA;AACvB,CAAC,EAdW,wBAAwB,KAAxB,wBAAwB,QAcnC;AAMD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAA+B;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,8FAA8F;QAC9F,2FAA2F;QAC3F,2FAA2F;QAC3F,2FAA2F;QAC3F,4FAA4F;QAC5F,yDAAyD;QACzD,MAAM,IAAI,KAAK,CACb,gGAAgG;cAC9F,mFAAmF,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B;IAC3C,OAAO,EA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AAa,WAAW,+BAA+B,cAAc,CAAC,IAAI,SAAS;kBACjF,GAAG,cAAc,CAAC,UAAU,yDAAyD;kBACrF,uBAAuB,cAAc,CAAC,UAAU,KAAK;SAC1D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,WAAW;QACX,UAAU,EAAE,cAAc,CAAC,IAAI;QAC/B,UAAU,EAAE,cAAc,CAAC,UAAU;QACrC,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import type { BackendProviderModule, BackendProtocolBinding } from '@wildo-ai/external-connectors-private/backend';\nimport { ExternalProvider_ExchangeProtocol_Kind, ProviderProtocolRuntimeKind } from '@wildo-ai/external-connectors-models';\nimport {\n getComposedProviderEntry,\n getComposedProviderSecretsCatalogue,\n LiveEnvKeySet,\n memoiseOverCatalogue,\n} from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\nexport interface ProviderSecretEnvBinding {\n protocolKind: string;\n secretRef: string;\n envVarName: string;\n required?: boolean;\n executionProfileRef?: string;\n}\n\n/**\n * Which provider secrets a generated runtime environment is entitled to.\n *\n * ## Why this is a named vocabulary rather than `readonly string[] | null`\n *\n * The scope answers a fail-closed SECURITY question — \"may this process read the application's\n * Stripe key?\" — and the previous encoding made three distinct answers share two values:\n *\n * | Meaning | Old encoding | Problem |\n * |---|---|---|\n * | Platform tier: every provider secret | `null` | fine, but only by convention |\n * | Declares none, legitimately (`myRustWorker` authors `providers: {}`) | `[]` | — |\n * | Nobody threaded the value through | `undefined` → `?? []` | **collapses into the row above** |\n *\n * So a wiring omission and a valid configuration produced byte-identical output, and the failure\n * was invisible: a `.env` missing every provider secret looks exactly like a correctly-scoped one\n * for a runtime that needs none. That is how five of six call sites shipped without a scope, and\n * how a `wildo config sync` came to strip `STRIPE_SECRET_KEY`, `RESEND_API_KEY`, `OPENAI_API_KEY`\n * and the `IMMUDB_*` connection out of the Wonder Todos backend `.env` — the application then died\n * at startup resolving its billing provider, three layers away from the cause.\n *\n * Fail-closed is the correct posture for a DECISION. Applied to an OMISSION it is a silent outage.\n * This union removes the omission from the type system: there is no value meaning \"not stated\", so\n * a caller must decide, and a new call site cannot compile without deciding.\n *\n * @see {@link declaredProviderScope} / {@link platformTierAllProvidersScope} — the two constructors.\n */\nexport enum RuntimeProviderScopeKind {\n /**\n * Platform-tier runtime (apps-manager, the dev companion): receives every provider secret in the\n * environment. A deliberate, reviewable declaration — never the default, and never what an\n * application-tier runtime gets.\n */\n PLATFORM_TIER_ALL_PROVIDERS = 'platform_tier_all_providers',\n /**\n * Application-tier runtime: exactly the providers its `providers.scopes.{backend,workers.<name>,\n * minions.<name>}.providers` authors, and nothing else. An EMPTY set is a legitimate, explicit\n * answer here — it means the runtime declared no provider — which is precisely why it must not\n * double as the encoding for \"the caller forgot\".\n */\n DECLARED = 'declared',\n}\n\nexport type RuntimeProviderScope =\n | { readonly kind: RuntimeProviderScopeKind.PLATFORM_TIER_ALL_PROVIDERS }\n | { readonly kind: RuntimeProviderScopeKind.DECLARED; readonly providerRefs: readonly string[] };\n\n/**\n * The application-tier scope: exactly the authored provider refs.\n *\n * Pass the refs resolved from `providers.scopes.*` — an empty array is meaningful and accepted\n * (the runtime authored no provider), so this constructor deliberately does NOT treat `[]` as a\n * mistake to be corrected.\n */\nexport function declaredProviderScope(providerRefs: readonly string[]): RuntimeProviderScope {\n if (!Array.isArray(providerRefs)) {\n // The type system cannot reach every caller: env targets are built behind `as never` casts in\n // tests, and a JSON-shaped target could arrive without the field at all. In those paths an\n // absent value would flow straight through as `providerRefs: undefined` and be filtered as\n // \"declares nothing\" — reinstating, at runtime, exactly the silent-empty failure the union\n // removed from the type. Throwing keeps the two states distinguishable everywhere: an empty\n // scope has to be WRITTEN as `[]`, never merely omitted.\n throw new Error(\n 'declaredProviderScope() requires an explicit provider-ref array. Pass `[]` for a runtime that '\n + 'authors no provider — an omitted scope is not the same statement as an empty one.',\n );\n }\n return { kind: RuntimeProviderScopeKind.DECLARED, providerRefs };\n}\n\n/**\n * The platform-tier scope: every provider secret.\n *\n * A function rather than a shared constant so each call site reads as its own decision at the\n * point it is made, and so no consumer can retain a reference and hand it to an application-tier\n * builder later.\n */\nexport function platformTierAllProvidersScope(): RuntimeProviderScope {\n return { kind: RuntimeProviderScopeKind.PLATFORM_TIER_ALL_PROVIDERS };\n}\n\n/**\n * The authored `providerConfigurations` keys that can carry a provider module's declared protocol.\n *\n * Two spellings, because the two sides of this lookup name one vocabulary differently: a provider\n * module declares `protocol: 'LLM_PROVIDER'` — the enum MEMBER NAME — while an application authors\n * `[ExternalProvider_ExchangeProtocol_Kind.LLM_PROVIDER]`, which evaluates to the enum VALUE\n * `'llm_provider'`. Neither side is wrong; something has to translate.\n *\n * DERIVED from the enum rather than hand-listed, because the hand-listed table this replaces\n * drifted in both directions at once and neither direction could be seen. Typed\n * `Record<string, string[]>`, it kept a `CLI_RUNTIME` row after that kind was retired — an inert\n * entry no compiler could flag — and never gained `AGENT_CLIENT_PROTOCOL`, `IMAGE_PROVIDER` or\n * `DOCUMENT_EXTRACTION_PROVIDER`, because a missing entry resolves to `undefined` and the fallback\n * then tries only the uppercase member name, which no authored configuration ever uses. The live\n * consequence was that an ACP provider's authored `executionProfiles` were never found, so a\n * `SECRET_REF_ENV_INJECTION` profile bound no environment variable and failed at auth time with\n * nothing pointing back here.\n *\n * Reading the enum cannot omit a member and cannot retain a retired one.\n *\n * `backendProtocol` arrives as a bare `string` (`BackendProtocolBinding` is generic over it), so\n * the index cast is the boundary where an untyped value meets the enum. A string enum has no\n * reverse mapping, so a value that is not a member name reads back `undefined` — which is the\n * signal to fall back to the protocol string itself rather than to guess a second spelling.\n */\nfunction backendProtocolConfigKeys(backendProtocol: string): readonly string[] {\n const wireValue = (ExternalProvider_ExchangeProtocol_Kind as Record<string, string | undefined>)[\n backendProtocol\n ];\n return wireValue === undefined ? [backendProtocol] : [backendProtocol, wireValue];\n}\n\nfunction getConfiguredProtocol(\n configuredProtocols: Partial<Record<string, Record<string, unknown>>> | undefined,\n backendProtocol: string,\n): Record<string, unknown> | undefined {\n for (const key of backendProtocolConfigKeys(backendProtocol)) {\n const config = configuredProtocols?.[key];\n if (config) return config;\n }\n return undefined;\n}\n\n/**\n * EXPORTED since #341 so the per-protocol binding is reachable on its own.\n *\n * Since #329 the ref is resolved through the COMPOSED catalogue rather than the engine registry,\n * so a package-shipped provider's protocols reach this function as soon as discovery registers it.\n * A contribution-sourced entry carries no runtime contracts (a binding is code, a contribution is\n * data), so this function is reached for such a provider only when a caller holds a binding of its\n * own; its secret keys are attributed from the contract half instead, which is complete — see\n * `composed-provider-catalogue.ts`.\n */\nexport function getProtocolSecretEnvBindings(\n providerRef: string,\n protocol: BackendProtocolBinding,\n configuredProtocol?: Record<string, unknown>,\n): ProviderSecretEnvBinding[] {\n const bindings: ProviderSecretEnvBinding[] = [];\n\n const pushSecret = (secretRef: string | undefined) => {\n if (!secretRef) return;\n const matchingEntry = getComposedProviderEntry(providerRef)\n ?.secrets.find((entry) => entry.envVarName === secretRef);\n bindings.push({\n protocolKind: protocol.protocol,\n secretRef,\n envVarName: matchingEntry?.envVarName ?? secretRef,\n required: matchingEntry?.required,\n });\n };\n\n const runtimeContract = protocol.runtimeContract;\n\n switch (runtimeContract.kind) {\n case ProviderProtocolRuntimeKind.LLM:\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.REST:\n /*\n * Same shape as `llm` above: the contract's `apiKey.secretRef` names the env var carrying the\n * key. Absent, this switch's `default` THREW at module load — and because these bindings are\n * computed while the module is evaluated, that killed the ENTIRE CLI: `wildo help` and\n * `wildo config validate` both died with `Unsupported provider runtime contract kind: rest`,\n * so a single unhandled provider kind made every unrelated command unusable.\n */\n pushSecret(runtimeContract.apiKey?.secretRef);\n break;\n case ProviderProtocolRuntimeKind.IMAGE:\n // Image-generation transport (gpt-image) — same API-key secret shape as llm.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.EMBEDDINGS:\n // Embeddings transport (RAG drain/retrieval) — same API-key secret shape as llm/image.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.DOCUMENT_EXTRACTION:\n // Document-extraction transport (OCR) — same API-key secret shape as llm/image/embeddings,\n // even though this family builds its own HTTPS request instead of handing the key to an SDK.\n // What the binding needs is the env var NAME, which is identical either way. A contract that signs\n // each request instead (#3426, AWS Textract) holds its two halves and an optional session token.\n pushSecret(runtimeContract.apiKey?.secretRef);\n pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);\n pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);\n pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);\n break;\n case ProviderProtocolRuntimeKind.CONTENT_SAFETY:\n // A content-safety classifier (#2292): the same API-key shape as document extraction.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.ELECTRONIC_SIGNATURE:\n // An electronic-signature vendor (#2293): one API key in a header, like the classifier above.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.EMAIL:\n // The `email` runtime contract is a discriminated union on `delivery`:\n // the network variant (real providers — Resend, Postmark, Mailgun, …)\n // carries an `apiKey.secretRef`, while the `delivery: 'log'` variant\n // (the `email-preview` local/dev provider) intentionally carries NO\n // credentials — a log sink needs no API key. Branch on the contract\n // field, never on the provider ref: a log provider has no secret to bind.\n if (runtimeContract.delivery !== 'log') {\n pushSecret(runtimeContract.apiKey.secretRef);\n }\n break;\n case ProviderProtocolRuntimeKind.OAUTH2_SSO:\n pushSecret(runtimeContract.clientSecretRef);\n if (typeof runtimeContract.extensions?.teamIdSecretRef === 'string') {\n pushSecret(runtimeContract.extensions.teamIdSecretRef);\n }\n if (typeof runtimeContract.extensions?.keyIdSecretRef === 'string') {\n pushSecret(runtimeContract.extensions.keyIdSecretRef);\n }\n break;\n case ProviderProtocolRuntimeKind.BILLING:\n case ProviderProtocolRuntimeKind.WEBHOOK_ORIGINATOR:\n pushSecret(runtimeContract.secretRef);\n break;\n case ProviderProtocolRuntimeKind.SMS:\n // A receiving-email provider: the API key its message and attachment fetches carry (#1630).\n case ProviderProtocolRuntimeKind.EMAIL_INBOUND:\n pushSecret(runtimeContract.auth.secretRef);\n break;\n case ProviderProtocolRuntimeKind.AGENT_CLIENT_PROTOCOL:\n // A coding agent under host-managed auth (the default) declares no\n // secretRef at all — `pushSecret` is a no-op for `undefined`, which is\n // the correct outcome: nothing to bind, and nothing to warn about.\n pushSecret(runtimeContract.secretRef);\n break;\n default: {\n // Exhaustive on purpose: every engine-side switch over `runtimeContract.kind` carries this\n // `never` check, and this site was the one that did not — which is exactly how the\n // `embeddings` kind shipped without a case here and crashed `wildo local dev` at module load\n // (2026-08-27). A new kind must fail COMPILATION here, not the next developer's startup.\n const exhaustiveCheck: never = runtimeContract;\n throw new Error(`Unsupported provider runtime contract kind: ${JSON.stringify(exhaustiveCheck)}`);\n }\n }\n\n // Execution-profile secret bindings.\n //\n // NOTE this is a SECOND dispatch on the same axis as the switch above, and it\n // is an `if` rather than a `case`, so the `never` check does NOT protect it:\n // a new execution-profile-bearing kind added to the switch and forgotten here\n // compiles perfectly and silently binds no environment variable, leaving the\n // agent to fail at auth time with no indication that a secret was authored.\n // Every kind that owns execution profiles must be listed.\n if (runtimeContract.kind === ProviderProtocolRuntimeKind.AGENT_CLIENT_PROTOCOL) {\n const agentClientProtocolConfig = configuredProtocol as\n | {\n executionProfiles?: Record<\n string,\n {\n authMode?: string;\n secretRef?: string;\n secretEnvVarName?: string;\n }\n >;\n }\n | undefined;\n const executionProfiles = agentClientProtocolConfig?.executionProfiles ?? {};\n for (const [executionProfileRef, executionProfile] of Object.entries(executionProfiles)) {\n if (\n executionProfile.authMode === 'secret_ref_env_injection'\n && executionProfile.secretRef\n && executionProfile.secretEnvVarName\n ) {\n bindings.push({\n protocolKind: protocol.protocol,\n secretRef: executionProfile.secretRef,\n envVarName: executionProfile.secretEnvVarName,\n executionProfileRef,\n });\n }\n }\n }\n\n return bindings.filter((binding, index, allBindings) => (\n allBindings.findIndex((candidate) => (\n candidate.protocolKind === binding.protocolKind\n && candidate.secretRef === binding.secretRef\n && candidate.envVarName === binding.envVarName\n && candidate.executionProfileRef === binding.executionProfileRef\n )) === index\n ));\n}\n\n/**\n * Every environment variable the named provider's PROTOCOL BINDINGS require.\n *\n * Resolves through the composed catalogue (#329). A provider known only from a companion\n * contribution has no runtime contracts, so this answers `[]` for it — deliberately, and without\n * loss: its secret keys are classified and allow-listed from its `secretsContract` shape, which\n * for every engine provider measured is a superset of what the bindings name.\n */\nexport function getProviderSecretEnvBindings(\n providerRef: string,\n configuredProtocols?: Partial<Record<string, Record<string, unknown>>>,\n): ProviderSecretEnvBinding[] {\n const entry = getComposedProviderEntry(providerRef);\n if (!entry) return [];\n\n return entry.protocolBindings.flatMap((protocol) => (\n getProtocolSecretEnvBindings(\n providerRef,\n protocol,\n getConfiguredProtocol(configuredProtocols, protocol.protocol),\n )\n ));\n}\n\n/**\n * Derives the canonical env var name for a provider's generic secret binding\n * from its protocol definitions.\n *\n * This is useful for setup flows that collect one provider secret value and\n * need to store it directly in the canonical `providerEnv` map. Transport-aware\n * callers should still prefer `getProviderSecretEnvBindings()`.\n */\nexport function getProviderSecretEnvVarName(\n providerRefOrModule: string | BackendProviderModule,\n): string | undefined {\n const providerRef =\n typeof providerRefOrModule === 'string'\n ? providerRefOrModule\n : providerRefOrModule.metadata.ref;\n const bindings = getProviderSecretEnvBindings(providerRef);\n return bindings.find((binding) => !binding.executionProfileRef)?.envVarName;\n}\n\n/**\n * Every provider-related env var name that must be classified as sensitive.\n *\n * Derived from the COMPOSED catalogue (#329) — engine tier plus whatever discovery registered —\n * so a package-shipped provider's key is classified like any other. It used to enumerate\n * `EngineBackendProviderRegistry` alone, which meant a package provider's key was attributable to\n * nobody: unclassified for the Secret/ConfigMap split, and kept by the confinement filter as\n * \"configuration\".\n *\n * Recomputed whenever composition changes rather than cached once, because discovery necessarily\n * runs after this module is imported.\n */\nexport const getProviderSensitiveEnvKeys: () => ReadonlySet<string> = memoiseOverCatalogue(() => {\n const keys = new Set<string>();\n for (const entry of getComposedProviderSecretsCatalogue().values()) {\n for (const secret of entry.secrets) keys.add(secret.envVarName);\n for (const binding of getProviderSecretEnvBindings(entry.providerRef)) keys.add(binding.envVarName);\n }\n return keys;\n});\n\n/** One secret a provider declares. */\nexport interface ProviderSelectionSecret {\n envVarName: string;\n description?: string;\n /** The provider refuses to boot without this var once the provider is enabled. */\n required: boolean;\n}\n\n/** One provider that declares at least one secret, with its operator-facing label. */\nexport interface ProviderSelectionCatalogEntry {\n providerRef: string;\n /** Operator-facing label (falls back to the ref when no display name is set). */\n label: string;\n /** Every secret this provider declares, in contract order. */\n secrets: ProviderSelectionSecret[];\n}\n\n/**\n * Every provider that declares a secret, derived from the COMPOSED provider catalogue (engine tier plus\n * whatever discovery registered — #329), sorted by label. `wildo setup`'s summary names the configured\n * providers from it.\n *\n * It used to power a setup step that offered this whole catalogue for credentials, grouped by a\n * presentation category. That step was removed (#1637): setup asks only for the companion's LLM key, and\n * every other secret is asked when its feature needs it (`wildo secrets`), derived from what the\n * application scopes rather than from everything that exists. The grouping went with it.\n *\n * Providers with an empty `secretsContract` (e.g. the `email-preview` log sink) are omitted.\n */\nexport function getProviderSelectionCatalog(): ProviderSelectionCatalogEntry[] {\n const entries: ProviderSelectionCatalogEntry[] = [];\n for (const provider of getComposedProviderSecretsCatalogue().values()) {\n const secrets: ProviderSelectionSecret[] = provider.secrets.map((secret) => ({\n envVarName: secret.envVarName,\n description: secret.description,\n required: secret.required,\n }));\n if (secrets.length === 0) continue;\n entries.push({ providerRef: provider.providerRef, label: provider.label, secrets });\n }\n return entries.sort((a, b) => a.label.localeCompare(b.label));\n}\n\n/**\n * All provider env-var names classified as sensitive, as a LIVE view.\n *\n * It was a module-load snapshot until #329, and a snapshot cannot work once composition is a\n * thing that happens: this module is imported by `credentials.schemas.ts` on the CLI's first\n * touch of the credential layer, which is always before an application's provider packages have\n * been discovered. A snapshot would therefore have been permanently blind to exactly the tier\n * this slice exists to classify. The exported NAME and the `.has()` shape are unchanged, so its\n * consumers need no edit.\n */\nexport const PROVIDER_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(getProviderSensitiveEnvKeys);\n\n// ============================================================================\n// Provider API-key resolution over the composed catalogue (seam for #331)\n// ============================================================================\n\n/**\n * Why a provider's credential could not be resolved.\n *\n * A closed vocabulary rather than a message string, because the caller BRANCHES on it: an\n * executor surfaces `SECRET_NOT_PROVISIONED` to an operator as \"run `wildo secrets set`\", and\n * `NOT_IN_SCOPE` to a developer as \"this runtime does not declare that provider\" — two very\n * different remedies that a single \"failed to resolve\" would have flattened.\n */\nexport enum ProviderApiKeyRefusal {\n /** No entry in the composed catalogue claims the ref — engine tier or discovered. */\n UNKNOWN_PROVIDER = 'unknown_provider',\n /** The runtime's declared provider scope does not carry this provider. */\n NOT_IN_SCOPE = 'not_in_scope',\n /** An operation named `requiredScopes` slugs the provider does not declare. */\n UNDECLARED_SCOPES = 'undeclared_scopes',\n /**\n * The caller named a `secretSlug` the provider does not declare.\n *\n * Distinct from `UNDECLARED_SCOPES` on purpose, even though both mean \"a slug that is not in the\n * contract\": one says an OPERATION requires a credential the package never ships (re-generate or\n * retire the operation), the other says THIS CALL asked for the wrong slug (a caller bug). A\n * caller branches differently on each, and merging two remedies under one member is exactly the\n * vocabulary collapse this repository's closed-vocabulary rule exists to prevent.\n */\n UNDECLARED_SECRET_SLUG = 'undeclared_secret_slug',\n /** The contract declares several candidate secrets and the caller named none. */\n AMBIGUOUS_SECRET = 'ambiguous_secret',\n /** The contract is satisfied; the value is simply not provisioned in this environment. */\n SECRET_NOT_PROVISIONED = 'secret_not_provisioned',\n}\n\nexport type ProviderApiKeyResolution =\n | { ok: true; providerRef: string; secretSlug: string; envVarName: string; value: string }\n | { ok: false; providerRef: string; refusal: ProviderApiKeyRefusal; detail: string };\n\nexport interface ProviderApiKeyRequest {\n providerRef: string;\n /**\n * What the runtime asking for the key is entitled to. Positional-equivalent to the scope\n * threaded through {@link declaredProviderScope} everywhere else in this layer, and required\n * for the same reason: an optional entitlement is one nobody decides, and the whole provider\n * bag reaching every runtime is what that produced last time.\n */\n runtimeScope: RuntimeProviderScope;\n /** Where values come from. Never `process.env` read by this function — the caller decides. */\n providerEnv: Record<string, string>;\n /**\n * Secret-contract SLUGS an operation requires, checked against the provider's contract.\n *\n * These are contract slugs, NOT OAuth scopes: a delegated-authorization scope check needs a\n * connected-account store and belongs to the delegated-auth slice. What is honestly checkable\n * here is that every credential a catalogue operation names is one the provider package\n * actually declares — so a generated operation asking for a credential its package never\n * ships is refused at resolution instead of at the vendor's 401.\n */\n requiredScopes?: readonly string[];\n /** Which contract slug carries the key. Defaults to the sole required (else sole) secret. */\n secretSlug?: string;\n}\n\n/**\n * Resolve one provider credential over the COMPOSED catalogue.\n *\n * The seam #331's operation executor consumes (plan, wave-1 seam table). Three properties are\n * what make it worth having over a bare `providerEnv[secretRef]`:\n *\n * 1. It resolves over the composed catalogue, so it answers for a package-shipped provider the\n * moment discovery registers one, and refuses `UNKNOWN_PROVIDER` BY NAME before that — rather\n * than silently reading an env var nothing claims.\n * 2. It checks entitlement against the same {@link RuntimeProviderScope} the confinement filter\n * uses, so \"the executor could read it\" and \"the env var was allowed into this runtime\" can\n * never disagree.\n * 3. It never touches `process.env`. The caller supplies the source, which keeps the function a\n * pure decision and therefore testable without an ambient environment.\n */\nexport function getProviderApiKey(input: ProviderApiKeyRequest): ProviderApiKeyResolution {\n const { providerRef, runtimeScope, providerEnv, requiredScopes = [], secretSlug } = input;\n\n const entry = getComposedProviderEntry(providerRef);\n if (!entry) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.UNKNOWN_PROVIDER,\n detail:\n `No provider '${providerRef}' in the composed catalogue. Either the application does not `\n + 'declare its package, or discovery has not registered its companion contribution.',\n };\n }\n\n if (\n runtimeScope.kind === RuntimeProviderScopeKind.DECLARED\n && !runtimeScope.providerRefs.includes(providerRef)\n ) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.NOT_IN_SCOPE,\n detail:\n `This runtime declares [${runtimeScope.providerRefs.join(', ') || 'none'}] and not `\n + `'${providerRef}', so its credential is deliberately absent from this environment.`,\n };\n }\n\n const declaredSlugs = new Set(entry.secrets.map((secret) => secret.slug));\n const missingScopes = requiredScopes.filter((slug) => !declaredSlugs.has(slug));\n if (missingScopes.length > 0) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.UNDECLARED_SCOPES,\n detail:\n `Provider '${providerRef}' declares no secret-contract slug [${missingScopes.join(', ')}]; `\n + `its contract holds [${[...declaredSlugs].join(', ') || 'none'}].`,\n };\n }\n\n const candidates = entry.secrets.filter((secret) => secret.required);\n const resolvedSecret = secretSlug\n ? entry.secrets.find((secret) => secret.slug === secretSlug)\n : (candidates.length === 1 ? candidates[0] : (entry.secrets.length === 1 ? entry.secrets[0] : undefined));\n\n if (!resolvedSecret) {\n return {\n ok: false,\n providerRef,\n refusal: secretSlug ? ProviderApiKeyRefusal.UNDECLARED_SECRET_SLUG : ProviderApiKeyRefusal.AMBIGUOUS_SECRET,\n detail: secretSlug\n ? `Provider '${providerRef}' declares no secret-contract slug '${secretSlug}'.`\n : `Provider '${providerRef}' declares ${entry.secrets.length} secrets and none is uniquely `\n + 'required — name the slug that carries the credential.',\n };\n }\n\n const value = providerEnv[resolvedSecret.envVarName];\n if (!value) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.SECRET_NOT_PROVISIONED,\n detail:\n `Provider '${providerRef}' is in scope and declares '${resolvedSecret.slug}', but `\n + `${resolvedSecret.envVarName} carries no value in this environment. Provide it with `\n + `\\`wildo secrets set ${resolvedSecret.envVarName}\\`.`,\n };\n }\n\n return {\n ok: true,\n providerRef,\n secretSlug: resolvedSecret.slug,\n envVarName: resolvedSecret.envVarName,\n value,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider-env-vars.utils.js","sourceRoot":"","sources":["../../../../src/services/credentials/provider-env-vars.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sCAAsC,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAC3H,OAAO,EACL,wBAAwB,EACxB,mCAAmC,EACnC,aAAa,EACb,oBAAoB,GACrB,MAAM,6DAA6D,CAAC;AAUrE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAN,IAAY,wBAcX;AAdD,WAAY,wBAAwB;IAClC;;;;OAIG;IACH,uFAA2D,CAAA;IAC3D;;;;;OAKG;IACH,iDAAqB,CAAA;AACvB,CAAC,EAdW,wBAAwB,KAAxB,wBAAwB,QAcnC;AAMD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAA+B;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,8FAA8F;QAC9F,2FAA2F;QAC3F,2FAA2F;QAC3F,2FAA2F;QAC3F,4FAA4F;QAC5F,yDAAyD;QACzD,MAAM,IAAI,KAAK,CACb,gGAAgG;cAC9F,mFAAmF,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B;IAC3C,OAAO,EAAE,IAAI,EAAE,wBAAwB,CAAC,2BAA2B,EAAE,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAS,yBAAyB,CAAC,eAAuB;IACxD,MAAM,SAAS,GAAI,sCAA6E,CAC9F,eAAe,CAChB,CAAC;IACF,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AACpF,CAAC;AA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E,KAAK;YACT,WAAW;YACX,OAAO,EAAE,qBAAqB,CAAC,sBAAsB;YACrD,MAAM,EACJ,aAAa,WAAW,+BAA+B,cAAc,CAAC,IAAI,SAAS;kBACjF,GAAG,cAAc,CAAC,UAAU,yDAAyD;kBACrF,uBAAuB,cAAc,CAAC,UAAU,KAAK;SAC1D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,WAAW;QACX,UAAU,EAAE,cAAc,CAAC,IAAI;QAC/B,UAAU,EAAE,cAAc,CAAC,UAAU;QACrC,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["import type { BackendProviderModule, BackendProtocolBinding } from '@wildo-ai/external-connectors-private/backend';\nimport { ExternalProvider_ExchangeProtocol_Kind, ProviderProtocolRuntimeKind } from '@wildo-ai/external-connectors-models';\nimport {\n getComposedProviderEntry,\n getComposedProviderSecretsCatalogue,\n LiveEnvKeySet,\n memoiseOverCatalogue,\n} from '~wildo-cli/services/credentials/composed-provider-catalogue';\n\nexport interface ProviderSecretEnvBinding {\n protocolKind: string;\n secretRef: string;\n envVarName: string;\n required?: boolean;\n executionProfileRef?: string;\n}\n\n/**\n * Which provider secrets a generated runtime environment is entitled to.\n *\n * ## Why this is a named vocabulary rather than `readonly string[] | null`\n *\n * The scope answers a fail-closed SECURITY question — \"may this process read the application's\n * Stripe key?\" — and the previous encoding made three distinct answers share two values:\n *\n * | Meaning | Old encoding | Problem |\n * |---|---|---|\n * | Platform tier: every provider secret | `null` | fine, but only by convention |\n * | Declares none, legitimately (`myRustWorker` authors `providers: {}`) | `[]` | — |\n * | Nobody threaded the value through | `undefined` → `?? []` | **collapses into the row above** |\n *\n * So a wiring omission and a valid configuration produced byte-identical output, and the failure\n * was invisible: a `.env` missing every provider secret looks exactly like a correctly-scoped one\n * for a runtime that needs none. That is how five of six call sites shipped without a scope, and\n * how a `wildo config sync` came to strip `STRIPE_SECRET_KEY`, `RESEND_API_KEY`, `OPENAI_API_KEY`\n * and the `IMMUDB_*` connection out of the Wonder Todos backend `.env` — the application then died\n * at startup resolving its billing provider, three layers away from the cause.\n *\n * Fail-closed is the correct posture for a DECISION. Applied to an OMISSION it is a silent outage.\n * This union removes the omission from the type system: there is no value meaning \"not stated\", so\n * a caller must decide, and a new call site cannot compile without deciding.\n *\n * @see {@link declaredProviderScope} / {@link platformTierAllProvidersScope} — the two constructors.\n */\nexport enum RuntimeProviderScopeKind {\n /**\n * Platform-tier runtime (apps-manager, the dev companion): receives every provider secret in the\n * environment. A deliberate, reviewable declaration — never the default, and never what an\n * application-tier runtime gets.\n */\n PLATFORM_TIER_ALL_PROVIDERS = 'platform_tier_all_providers',\n /**\n * Application-tier runtime: exactly the providers its `providers.scopes.{backend,workers.<name>,\n * minions.<name>}.providers` authors, and nothing else. An EMPTY set is a legitimate, explicit\n * answer here — it means the runtime declared no provider — which is precisely why it must not\n * double as the encoding for \"the caller forgot\".\n */\n DECLARED = 'declared',\n}\n\nexport type RuntimeProviderScope =\n | { readonly kind: RuntimeProviderScopeKind.PLATFORM_TIER_ALL_PROVIDERS }\n | { readonly kind: RuntimeProviderScopeKind.DECLARED; readonly providerRefs: readonly string[] };\n\n/**\n * The application-tier scope: exactly the authored provider refs.\n *\n * Pass the refs resolved from `providers.scopes.*` — an empty array is meaningful and accepted\n * (the runtime authored no provider), so this constructor deliberately does NOT treat `[]` as a\n * mistake to be corrected.\n */\nexport function declaredProviderScope(providerRefs: readonly string[]): RuntimeProviderScope {\n if (!Array.isArray(providerRefs)) {\n // The type system cannot reach every caller: env targets are built behind `as never` casts in\n // tests, and a JSON-shaped target could arrive without the field at all. In those paths an\n // absent value would flow straight through as `providerRefs: undefined` and be filtered as\n // \"declares nothing\" — reinstating, at runtime, exactly the silent-empty failure the union\n // removed from the type. Throwing keeps the two states distinguishable everywhere: an empty\n // scope has to be WRITTEN as `[]`, never merely omitted.\n throw new Error(\n 'declaredProviderScope() requires an explicit provider-ref array. Pass `[]` for a runtime that '\n + 'authors no provider — an omitted scope is not the same statement as an empty one.',\n );\n }\n return { kind: RuntimeProviderScopeKind.DECLARED, providerRefs };\n}\n\n/**\n * The platform-tier scope: every provider secret.\n *\n * A function rather than a shared constant so each call site reads as its own decision at the\n * point it is made, and so no consumer can retain a reference and hand it to an application-tier\n * builder later.\n */\nexport function platformTierAllProvidersScope(): RuntimeProviderScope {\n return { kind: RuntimeProviderScopeKind.PLATFORM_TIER_ALL_PROVIDERS };\n}\n\n/**\n * The authored `providerConfigurations` keys that can carry a provider module's declared protocol.\n *\n * Two spellings, because the two sides of this lookup name one vocabulary differently: a provider\n * module declares `protocol: 'LLM_PROVIDER'` — the enum MEMBER NAME — while an application authors\n * `[ExternalProvider_ExchangeProtocol_Kind.LLM_PROVIDER]`, which evaluates to the enum VALUE\n * `'llm_provider'`. Neither side is wrong; something has to translate.\n *\n * DERIVED from the enum rather than hand-listed, because the hand-listed table this replaces\n * drifted in both directions at once and neither direction could be seen. Typed\n * `Record<string, string[]>`, it kept a `CLI_RUNTIME` row after that kind was retired — an inert\n * entry no compiler could flag — and never gained `AGENT_CLIENT_PROTOCOL`, `IMAGE_PROVIDER` or\n * `DOCUMENT_EXTRACTION_PROVIDER`, because a missing entry resolves to `undefined` and the fallback\n * then tries only the uppercase member name, which no authored configuration ever uses. The live\n * consequence was that an ACP provider's authored `executionProfiles` were never found, so a\n * `SECRET_REF_ENV_INJECTION` profile bound no environment variable and failed at auth time with\n * nothing pointing back here.\n *\n * Reading the enum cannot omit a member and cannot retain a retired one.\n *\n * `backendProtocol` arrives as a bare `string` (`BackendProtocolBinding` is generic over it), so\n * the index cast is the boundary where an untyped value meets the enum. A string enum has no\n * reverse mapping, so a value that is not a member name reads back `undefined` — which is the\n * signal to fall back to the protocol string itself rather than to guess a second spelling.\n */\nfunction backendProtocolConfigKeys(backendProtocol: string): readonly string[] {\n const wireValue = (ExternalProvider_ExchangeProtocol_Kind as Record<string, string | undefined>)[\n backendProtocol\n ];\n return wireValue === undefined ? [backendProtocol] : [backendProtocol, wireValue];\n}\n\nfunction getConfiguredProtocol(\n configuredProtocols: Partial<Record<string, Record<string, unknown>>> | undefined,\n backendProtocol: string,\n): Record<string, unknown> | undefined {\n for (const key of backendProtocolConfigKeys(backendProtocol)) {\n const config = configuredProtocols?.[key];\n if (config) return config;\n }\n return undefined;\n}\n\n/**\n * EXPORTED since #341 so the per-protocol binding is reachable on its own.\n *\n * Since #329 the ref is resolved through the COMPOSED catalogue rather than the engine registry,\n * so a package-shipped provider's protocols reach this function as soon as discovery registers it.\n * A contribution-sourced entry carries no runtime contracts (a binding is code, a contribution is\n * data), so this function is reached for such a provider only when a caller holds a binding of its\n * own; its secret keys are attributed from the contract half instead, which is complete — see\n * `composed-provider-catalogue.ts`.\n */\nexport function getProtocolSecretEnvBindings(\n providerRef: string,\n protocol: BackendProtocolBinding,\n configuredProtocol?: Record<string, unknown>,\n): ProviderSecretEnvBinding[] {\n const bindings: ProviderSecretEnvBinding[] = [];\n\n const pushSecret = (secretRef: string | undefined) => {\n if (!secretRef) return;\n const matchingEntry = getComposedProviderEntry(providerRef)\n ?.secrets.find((entry) => entry.envVarName === secretRef);\n bindings.push({\n protocolKind: protocol.protocol,\n secretRef,\n envVarName: matchingEntry?.envVarName ?? secretRef,\n required: matchingEntry?.required,\n });\n };\n\n const runtimeContract = protocol.runtimeContract;\n\n switch (runtimeContract.kind) {\n case ProviderProtocolRuntimeKind.LLM:\n // An arm that signs each request instead (#3780, Amazon Bedrock with IAM credentials) holds its two halves and an\n // optional session token, exactly as a signed document-extraction arm does below.\n pushSecret(runtimeContract.apiKey?.secretRef);\n pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);\n pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);\n pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);\n break;\n case ProviderProtocolRuntimeKind.REST:\n /*\n * Same shape as `llm` above: the contract's `apiKey.secretRef` names the env var carrying the\n * key. Absent, this switch's `default` THREW at module load — and because these bindings are\n * computed while the module is evaluated, that killed the ENTIRE CLI: `wildo help` and\n * `wildo config validate` both died with `Unsupported provider runtime contract kind: rest`,\n * so a single unhandled provider kind made every unrelated command unusable.\n */\n pushSecret(runtimeContract.apiKey?.secretRef);\n break;\n case ProviderProtocolRuntimeKind.IMAGE:\n // Image-generation transport (gpt-image) — same API-key secret shape as llm.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.EMBEDDINGS:\n // Embeddings transport (RAG drain/retrieval) — same secret shape as llm, signed arms included (#3780).\n pushSecret(runtimeContract.apiKey?.secretRef);\n pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);\n pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);\n pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);\n break;\n case ProviderProtocolRuntimeKind.DOCUMENT_EXTRACTION:\n // Document-extraction transport (OCR) — same API-key secret shape as llm/image/embeddings,\n // even though this family builds its own HTTPS request instead of handing the key to an SDK.\n // What the binding needs is the env var NAME, which is identical either way. A contract that signs\n // each request instead (#3426, AWS Textract) holds its two halves and an optional session token.\n pushSecret(runtimeContract.apiKey?.secretRef);\n pushSecret(runtimeContract.requestSigning?.keyIdSecretRef);\n pushSecret(runtimeContract.requestSigning?.secretKeySecretRef);\n pushSecret(runtimeContract.requestSigning?.sessionTokenSecretRef);\n break;\n case ProviderProtocolRuntimeKind.CONTENT_SAFETY:\n // A content-safety classifier (#2292): the same API-key shape as document extraction.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.ELECTRONIC_SIGNATURE:\n // An electronic-signature vendor (#2293): one API key in a header, like the classifier above.\n pushSecret(runtimeContract.apiKey.secretRef);\n break;\n case ProviderProtocolRuntimeKind.EMAIL:\n // The `email` runtime contract is a discriminated union on `delivery`:\n // the network variant (real providers — Resend, Postmark, Mailgun, …)\n // carries an `apiKey.secretRef`, while the `delivery: 'log'` variant\n // (the `email-preview` local/dev provider) intentionally carries NO\n // credentials — a log sink needs no API key. Branch on the contract\n // field, never on the provider ref: a log provider has no secret to bind.\n if (runtimeContract.delivery !== 'log') {\n pushSecret(runtimeContract.apiKey.secretRef);\n }\n break;\n case ProviderProtocolRuntimeKind.OAUTH2_SSO:\n pushSecret(runtimeContract.clientSecretRef);\n if (typeof runtimeContract.extensions?.teamIdSecretRef === 'string') {\n pushSecret(runtimeContract.extensions.teamIdSecretRef);\n }\n if (typeof runtimeContract.extensions?.keyIdSecretRef === 'string') {\n pushSecret(runtimeContract.extensions.keyIdSecretRef);\n }\n break;\n case ProviderProtocolRuntimeKind.BILLING:\n case ProviderProtocolRuntimeKind.WEBHOOK_ORIGINATOR:\n pushSecret(runtimeContract.secretRef);\n break;\n case ProviderProtocolRuntimeKind.SMS:\n // A receiving-email provider: the API key its message and attachment fetches carry (#1630).\n case ProviderProtocolRuntimeKind.EMAIL_INBOUND:\n pushSecret(runtimeContract.auth.secretRef);\n break;\n case ProviderProtocolRuntimeKind.AGENT_CLIENT_PROTOCOL:\n // A coding agent under host-managed auth (the default) declares no\n // secretRef at all — `pushSecret` is a no-op for `undefined`, which is\n // the correct outcome: nothing to bind, and nothing to warn about.\n pushSecret(runtimeContract.secretRef);\n break;\n default: {\n // Exhaustive on purpose: every engine-side switch over `runtimeContract.kind` carries this\n // `never` check, and this site was the one that did not — which is exactly how the\n // `embeddings` kind shipped without a case here and crashed `wildo local dev` at module load\n // (2026-08-27). A new kind must fail COMPILATION here, not the next developer's startup.\n const exhaustiveCheck: never = runtimeContract;\n throw new Error(`Unsupported provider runtime contract kind: ${JSON.stringify(exhaustiveCheck)}`);\n }\n }\n\n // Execution-profile secret bindings.\n //\n // NOTE this is a SECOND dispatch on the same axis as the switch above, and it\n // is an `if` rather than a `case`, so the `never` check does NOT protect it:\n // a new execution-profile-bearing kind added to the switch and forgotten here\n // compiles perfectly and silently binds no environment variable, leaving the\n // agent to fail at auth time with no indication that a secret was authored.\n // Every kind that owns execution profiles must be listed.\n if (runtimeContract.kind === ProviderProtocolRuntimeKind.AGENT_CLIENT_PROTOCOL) {\n const agentClientProtocolConfig = configuredProtocol as\n | {\n executionProfiles?: Record<\n string,\n {\n authMode?: string;\n secretRef?: string;\n secretEnvVarName?: string;\n }\n >;\n }\n | undefined;\n const executionProfiles = agentClientProtocolConfig?.executionProfiles ?? {};\n for (const [executionProfileRef, executionProfile] of Object.entries(executionProfiles)) {\n if (\n executionProfile.authMode === 'secret_ref_env_injection'\n && executionProfile.secretRef\n && executionProfile.secretEnvVarName\n ) {\n bindings.push({\n protocolKind: protocol.protocol,\n secretRef: executionProfile.secretRef,\n envVarName: executionProfile.secretEnvVarName,\n executionProfileRef,\n });\n }\n }\n }\n\n return bindings.filter((binding, index, allBindings) => (\n allBindings.findIndex((candidate) => (\n candidate.protocolKind === binding.protocolKind\n && candidate.secretRef === binding.secretRef\n && candidate.envVarName === binding.envVarName\n && candidate.executionProfileRef === binding.executionProfileRef\n )) === index\n ));\n}\n\n/**\n * Every environment variable the named provider's PROTOCOL BINDINGS require.\n *\n * Resolves through the composed catalogue (#329). A provider known only from a companion\n * contribution has no runtime contracts, so this answers `[]` for it — deliberately, and without\n * loss: its secret keys are classified and allow-listed from its `secretsContract` shape, which\n * for every engine provider measured is a superset of what the bindings name.\n */\nexport function getProviderSecretEnvBindings(\n providerRef: string,\n configuredProtocols?: Partial<Record<string, Record<string, unknown>>>,\n): ProviderSecretEnvBinding[] {\n const entry = getComposedProviderEntry(providerRef);\n if (!entry) return [];\n\n return entry.protocolBindings.flatMap((protocol) => (\n getProtocolSecretEnvBindings(\n providerRef,\n protocol,\n getConfiguredProtocol(configuredProtocols, protocol.protocol),\n )\n ));\n}\n\n/**\n * Derives the canonical env var name for a provider's generic secret binding\n * from its protocol definitions.\n *\n * This is useful for setup flows that collect one provider secret value and\n * need to store it directly in the canonical `providerEnv` map. Transport-aware\n * callers should still prefer `getProviderSecretEnvBindings()`.\n */\nexport function getProviderSecretEnvVarName(\n providerRefOrModule: string | BackendProviderModule,\n): string | undefined {\n const providerRef =\n typeof providerRefOrModule === 'string'\n ? providerRefOrModule\n : providerRefOrModule.metadata.ref;\n const bindings = getProviderSecretEnvBindings(providerRef);\n return bindings.find((binding) => !binding.executionProfileRef)?.envVarName;\n}\n\n/**\n * Every provider-related env var name that must be classified as sensitive.\n *\n * Derived from the COMPOSED catalogue (#329) — engine tier plus whatever discovery registered —\n * so a package-shipped provider's key is classified like any other. It used to enumerate\n * `EngineBackendProviderRegistry` alone, which meant a package provider's key was attributable to\n * nobody: unclassified for the Secret/ConfigMap split, and kept by the confinement filter as\n * \"configuration\".\n *\n * Recomputed whenever composition changes rather than cached once, because discovery necessarily\n * runs after this module is imported.\n */\nexport const getProviderSensitiveEnvKeys: () => ReadonlySet<string> = memoiseOverCatalogue(() => {\n const keys = new Set<string>();\n for (const entry of getComposedProviderSecretsCatalogue().values()) {\n for (const secret of entry.secrets) keys.add(secret.envVarName);\n for (const binding of getProviderSecretEnvBindings(entry.providerRef)) keys.add(binding.envVarName);\n }\n return keys;\n});\n\n/** One secret a provider declares. */\nexport interface ProviderSelectionSecret {\n envVarName: string;\n description?: string;\n /** The provider refuses to boot without this var once the provider is enabled. */\n required: boolean;\n}\n\n/** One provider that declares at least one secret, with its operator-facing label. */\nexport interface ProviderSelectionCatalogEntry {\n providerRef: string;\n /** Operator-facing label (falls back to the ref when no display name is set). */\n label: string;\n /** Every secret this provider declares, in contract order. */\n secrets: ProviderSelectionSecret[];\n}\n\n/**\n * Every provider that declares a secret, derived from the COMPOSED provider catalogue (engine tier plus\n * whatever discovery registered — #329), sorted by label. `wildo setup`'s summary names the configured\n * providers from it.\n *\n * It used to power a setup step that offered this whole catalogue for credentials, grouped by a\n * presentation category. That step was removed (#1637): setup asks only for the companion's LLM key, and\n * every other secret is asked when its feature needs it (`wildo secrets`), derived from what the\n * application scopes rather than from everything that exists. The grouping went with it.\n *\n * Providers with an empty `secretsContract` (e.g. the `email-preview` log sink) are omitted.\n */\nexport function getProviderSelectionCatalog(): ProviderSelectionCatalogEntry[] {\n const entries: ProviderSelectionCatalogEntry[] = [];\n for (const provider of getComposedProviderSecretsCatalogue().values()) {\n const secrets: ProviderSelectionSecret[] = provider.secrets.map((secret) => ({\n envVarName: secret.envVarName,\n description: secret.description,\n required: secret.required,\n }));\n if (secrets.length === 0) continue;\n entries.push({ providerRef: provider.providerRef, label: provider.label, secrets });\n }\n return entries.sort((a, b) => a.label.localeCompare(b.label));\n}\n\n/**\n * All provider env-var names classified as sensitive, as a LIVE view.\n *\n * It was a module-load snapshot until #329, and a snapshot cannot work once composition is a\n * thing that happens: this module is imported by `credentials.schemas.ts` on the CLI's first\n * touch of the credential layer, which is always before an application's provider packages have\n * been discovered. A snapshot would therefore have been permanently blind to exactly the tier\n * this slice exists to classify. The exported NAME and the `.has()` shape are unchanged, so its\n * consumers need no edit.\n */\nexport const PROVIDER_SENSITIVE_ENV_KEYS: ReadonlySet<string> = new LiveEnvKeySet(getProviderSensitiveEnvKeys);\n\n// ============================================================================\n// Provider API-key resolution over the composed catalogue (seam for #331)\n// ============================================================================\n\n/**\n * Why a provider's credential could not be resolved.\n *\n * A closed vocabulary rather than a message string, because the caller BRANCHES on it: an\n * executor surfaces `SECRET_NOT_PROVISIONED` to an operator as \"run `wildo secrets set`\", and\n * `NOT_IN_SCOPE` to a developer as \"this runtime does not declare that provider\" — two very\n * different remedies that a single \"failed to resolve\" would have flattened.\n */\nexport enum ProviderApiKeyRefusal {\n /** No entry in the composed catalogue claims the ref — engine tier or discovered. */\n UNKNOWN_PROVIDER = 'unknown_provider',\n /** The runtime's declared provider scope does not carry this provider. */\n NOT_IN_SCOPE = 'not_in_scope',\n /** An operation named `requiredScopes` slugs the provider does not declare. */\n UNDECLARED_SCOPES = 'undeclared_scopes',\n /**\n * The caller named a `secretSlug` the provider does not declare.\n *\n * Distinct from `UNDECLARED_SCOPES` on purpose, even though both mean \"a slug that is not in the\n * contract\": one says an OPERATION requires a credential the package never ships (re-generate or\n * retire the operation), the other says THIS CALL asked for the wrong slug (a caller bug). A\n * caller branches differently on each, and merging two remedies under one member is exactly the\n * vocabulary collapse this repository's closed-vocabulary rule exists to prevent.\n */\n UNDECLARED_SECRET_SLUG = 'undeclared_secret_slug',\n /** The contract declares several candidate secrets and the caller named none. */\n AMBIGUOUS_SECRET = 'ambiguous_secret',\n /** The contract is satisfied; the value is simply not provisioned in this environment. */\n SECRET_NOT_PROVISIONED = 'secret_not_provisioned',\n}\n\nexport type ProviderApiKeyResolution =\n | { ok: true; providerRef: string; secretSlug: string; envVarName: string; value: string }\n | { ok: false; providerRef: string; refusal: ProviderApiKeyRefusal; detail: string };\n\nexport interface ProviderApiKeyRequest {\n providerRef: string;\n /**\n * What the runtime asking for the key is entitled to. Positional-equivalent to the scope\n * threaded through {@link declaredProviderScope} everywhere else in this layer, and required\n * for the same reason: an optional entitlement is one nobody decides, and the whole provider\n * bag reaching every runtime is what that produced last time.\n */\n runtimeScope: RuntimeProviderScope;\n /** Where values come from. Never `process.env` read by this function — the caller decides. */\n providerEnv: Record<string, string>;\n /**\n * Secret-contract SLUGS an operation requires, checked against the provider's contract.\n *\n * These are contract slugs, NOT OAuth scopes: a delegated-authorization scope check needs a\n * connected-account store and belongs to the delegated-auth slice. What is honestly checkable\n * here is that every credential a catalogue operation names is one the provider package\n * actually declares — so a generated operation asking for a credential its package never\n * ships is refused at resolution instead of at the vendor's 401.\n */\n requiredScopes?: readonly string[];\n /** Which contract slug carries the key. Defaults to the sole required (else sole) secret. */\n secretSlug?: string;\n}\n\n/**\n * Resolve one provider credential over the COMPOSED catalogue.\n *\n * The seam #331's operation executor consumes (plan, wave-1 seam table). Three properties are\n * what make it worth having over a bare `providerEnv[secretRef]`:\n *\n * 1. It resolves over the composed catalogue, so it answers for a package-shipped provider the\n * moment discovery registers one, and refuses `UNKNOWN_PROVIDER` BY NAME before that — rather\n * than silently reading an env var nothing claims.\n * 2. It checks entitlement against the same {@link RuntimeProviderScope} the confinement filter\n * uses, so \"the executor could read it\" and \"the env var was allowed into this runtime\" can\n * never disagree.\n * 3. It never touches `process.env`. The caller supplies the source, which keeps the function a\n * pure decision and therefore testable without an ambient environment.\n */\nexport function getProviderApiKey(input: ProviderApiKeyRequest): ProviderApiKeyResolution {\n const { providerRef, runtimeScope, providerEnv, requiredScopes = [], secretSlug } = input;\n\n const entry = getComposedProviderEntry(providerRef);\n if (!entry) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.UNKNOWN_PROVIDER,\n detail:\n `No provider '${providerRef}' in the composed catalogue. Either the application does not `\n + 'declare its package, or discovery has not registered its companion contribution.',\n };\n }\n\n if (\n runtimeScope.kind === RuntimeProviderScopeKind.DECLARED\n && !runtimeScope.providerRefs.includes(providerRef)\n ) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.NOT_IN_SCOPE,\n detail:\n `This runtime declares [${runtimeScope.providerRefs.join(', ') || 'none'}] and not `\n + `'${providerRef}', so its credential is deliberately absent from this environment.`,\n };\n }\n\n const declaredSlugs = new Set(entry.secrets.map((secret) => secret.slug));\n const missingScopes = requiredScopes.filter((slug) => !declaredSlugs.has(slug));\n if (missingScopes.length > 0) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.UNDECLARED_SCOPES,\n detail:\n `Provider '${providerRef}' declares no secret-contract slug [${missingScopes.join(', ')}]; `\n + `its contract holds [${[...declaredSlugs].join(', ') || 'none'}].`,\n };\n }\n\n const candidates = entry.secrets.filter((secret) => secret.required);\n const resolvedSecret = secretSlug\n ? entry.secrets.find((secret) => secret.slug === secretSlug)\n : (candidates.length === 1 ? candidates[0] : (entry.secrets.length === 1 ? entry.secrets[0] : undefined));\n\n if (!resolvedSecret) {\n return {\n ok: false,\n providerRef,\n refusal: secretSlug ? ProviderApiKeyRefusal.UNDECLARED_SECRET_SLUG : ProviderApiKeyRefusal.AMBIGUOUS_SECRET,\n detail: secretSlug\n ? `Provider '${providerRef}' declares no secret-contract slug '${secretSlug}'.`\n : `Provider '${providerRef}' declares ${entry.secrets.length} secrets and none is uniquely `\n + 'required — name the slug that carries the credential.',\n };\n }\n\n const value = providerEnv[resolvedSecret.envVarName];\n if (!value) {\n return {\n ok: false,\n providerRef,\n refusal: ProviderApiKeyRefusal.SECRET_NOT_PROVISIONED,\n detail:\n `Provider '${providerRef}' is in scope and declares '${resolvedSecret.slug}', but `\n + `${resolvedSecret.envVarName} carries no value in this environment. Provide it with `\n + `\\`wildo secrets set ${resolvedSecret.envVarName}\\`.`,\n };\n }\n\n return {\n ok: true,\n providerRef,\n secretSlug: resolvedSecret.slug,\n envVarName: resolvedSecret.envVarName,\n value,\n };\n}\n"]}
|
|
@@ -175,6 +175,15 @@ export declare const IMMUDB_CREDENTIAL_ENV_KEYS: {
|
|
|
175
175
|
* instead (a container mount path is meaningless without a container).
|
|
176
176
|
*/
|
|
177
177
|
export declare const IMMUDB_AUDIT_STATE_CONTAINER_DIR = "/var/lib/wildo/immudb-audit-state";
|
|
178
|
+
/**
|
|
179
|
+
* The LOCAL counterpart: the `local_data` subdirectory holding the immudb audit trust anchor on the developer's host.
|
|
180
|
+
* `IMMUDB_STATE_DIR` points at it (`env-configuration-generator.service.ts`), and `wildo local reset` wipes it together
|
|
181
|
+
* with the local immudb's own data (`wipeLocalDataServiceDirsForCompose`): an anchor must never outlive the ledger it
|
|
182
|
+
* anchors. The state-signing key is pinned for a self-hosted immudb, and under a pin a fresh ledger below an old anchor
|
|
183
|
+
* is a PROVEN tamper, not a re-bootstrap. A reset that wiped the ledger and kept the anchor raised that critical alert on
|
|
184
|
+
* the next stack after every reset (the QA VM resets before each e2e run: run 43234451120, #3775).
|
|
185
|
+
*/
|
|
186
|
+
export declare const IMMUDB_AUDIT_STATE_LOCAL_DATA_DIR = "immudb-audit-state";
|
|
178
187
|
export declare const PLATFORM_DATA_SERVICES_PROVIDER: {
|
|
179
188
|
readonly SELF_MANAGED: "self-managed";
|
|
180
189
|
readonly VALKEY_SELF: "valkey-self";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-services.schemas.d.ts","sourceRoot":"","sources":["../../../../src/services/data-services/data-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG1F;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,UAAU,eAAe;IAKzB,MAAM,WAAW;IAIjB,MAAM,WAAW;IASjB,MAAM,WAAW;IAKjB,OAAO,YAAY;CACpB;AAMD;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAYD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,2BAA2B;;;CAG9B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB;IAC7B,4EAA4E;;IAE5E,yCAAyC;;IAEzC,wEAAwE;;IAExE,4EAA4E;;IAE5E;;;;;;;OAOG;;IAEH,uFAAuF;;IAEvF,+EAA+E;;CAEvE,CAAC;AAEX,eAAO,MAAM,0BAA0B;;CAE7B,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;;CAI/B,CAAC;AAEX,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AAEX,eAAO,MAAM,8BAA8B;;;;CAIjC,CAAC;AAEX;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B;;;QAGnC;;;;;WAKG;;;;;QAKH;;;;WAIG;;QAEH;;;;;;WAMG;;QAEH;;;;;WAKG;;;CAGG,CAAC;AAEX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"data-services.schemas.d.ts","sourceRoot":"","sources":["../../../../src/services/data-services/data-services.schemas.ts"],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CAAoC;;;CAGvC,CAAC;AAMX,eAAO,MAAM,8CAA8C;;;;;CAKjD,CAAC;AAGX,eAAO,MAAM,2CAA2C;;;CAG9C,CAAC;AAGX;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -207,6 +207,15 @@ export const IMMUDB_CREDENTIAL_ENV_KEYS = {
|
|
|
207
207
|
* instead (a container mount path is meaningless without a container).
|
|
208
208
|
*/
|
|
209
209
|
export const IMMUDB_AUDIT_STATE_CONTAINER_DIR = '/var/lib/wildo/immudb-audit-state';
|
|
210
|
+
/**
|
|
211
|
+
* The LOCAL counterpart: the `local_data` subdirectory holding the immudb audit trust anchor on the developer's host.
|
|
212
|
+
* `IMMUDB_STATE_DIR` points at it (`env-configuration-generator.service.ts`), and `wildo local reset` wipes it together
|
|
213
|
+
* with the local immudb's own data (`wipeLocalDataServiceDirsForCompose`): an anchor must never outlive the ledger it
|
|
214
|
+
* anchors. The state-signing key is pinned for a self-hosted immudb, and under a pin a fresh ledger below an old anchor
|
|
215
|
+
* is a PROVEN tamper, not a re-bootstrap. A reset that wiped the ledger and kept the anchor raised that critical alert on
|
|
216
|
+
* the next stack after every reset (the QA VM resets before each e2e run: run 43234451120, #3775).
|
|
217
|
+
*/
|
|
218
|
+
export const IMMUDB_AUDIT_STATE_LOCAL_DATA_DIR = 'immudb-audit-state';
|
|
210
219
|
// ============================================================================
|
|
211
220
|
// Platform data services provider identifiers
|
|
212
221
|
// ============================================================================
|