@wildo-ai/platform-config-lib 1.1.7 → 1.1.8
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/esm/_unimplemented/index.d.ts.map +1 -1
- package/dist/esm/_unimplemented/index.js.map +1 -1
- package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
- package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts.map +1 -1
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
- package/dist/esm/credentials/credential-generator.service.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
- package/dist/esm/lockfile/build-parallelism.js.map +1 -1
- package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
- package/dist/esm/lockfile/canonical-json.js.map +1 -1
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-framework-config.js.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-worker-config.js.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
- package/dist/esm/project-config/npm-version-range.js.map +1 -1
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
- package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/digest.schemas.js.map +1 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
- package/dist/esm/registry/local-checkout-source.js.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-search.schemas.js.map +1 -1
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.js.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage-session-policy.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"object-storage-session-policy.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/object-storage-session-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,IAAI,CAAC;AAgB5D,SAAS,sBAAsB,CAAC,MAAc;IAC5C,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,0EAA0E,MAAM,IAAI,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,6BAA6B,CAAC,aAAqB;IAC1D,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,+EAA+E;cAC7E,8FAA8F,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,2BAA2B,CAAC,IAAY;IAC/C,+EAA+E;IAC/E,yDAAyD;IACzD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,2EAA2E,IAAI,IAAI,CAAC,CAAC;IACvG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAsC;IACpF,MAAM,MAAM,GAAG,sBAA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,uCAAuC,EAAE,CAAC;AACrI,CAAC","sourcesContent":["/**\n * The object-storage session policy — ONE description, shared by the party that\n * MINTS the credential and the party that VALIDATES a declaration against the\n * size limit.\n *\n * ## Why this lives here rather than on the broker\n *\n * It was a method on `ObjectStorageStsBrokerService` in apps-manager. Pure — no\n * I/O, no state — but unreachable from `minion-resource-access.validation.ts`,\n * which must refuse a `resourceAccess` declaration whose policy would not fit.\n * A validator computing length from its OWN model of the policy shape is a second\n * copy: change the entries here and the estimate silently drifts, so a declaration\n * passes validation and then fails at issuance — the very failure the check exists\n * to prevent, arriving through the check itself.\n *\n * `platform-config-lib` is contracts-and-helpers only, and both consumers already\n * depend on it (`saas-backend-lib` and `platform-infra-providers`), so no new\n * dependency edge was needed.\n */\n\n/**\n * The largest inline session policy an `AssumeRole` call will accept.\n *\n * **This is the MINIMUM across supported providers, not \"the MinIO limit\".** A\n * declaration valid anywhere must be valid everywhere, so the validator enforces\n * the tightest known ceiling. Today that is MinIO's, measured 2026-08-12 against a\n * live server by growing a policy until it refused:\n *\n * InvalidParameterValue Session policy should not exceed 2048 characters\n *\n * AWS S3 is NOT yet measured. Whoever measures it must LOWER this if AWS is\n * tighter — the name says \"session policy max\", not \"MinIO limit\", precisely so\n * that obligation is not read as somebody else's.\n */\nexport const OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS = 2048;\n\nexport interface ObjectStorageSessionPolicyInput {\n bucket: string;\n /** Platform-minted. The application cannot influence it; that is the whole confinement. */\n applicationId: string;\n /**\n * Storage names (from `resolveGrantStorageNames`) to confine to, one prefix each.\n *\n * Omitted or empty ⇒ confine to the whole application subtree, which is what a\n * runtime holding an application-wide credential gets. Supplying names narrows\n * it per declared resource.\n */\n storageNames?: readonly string[];\n}\n\nfunction assertPolicySafeBucket(bucket: string): string {\n if (!/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/.test(bucket)) {\n throw new Error(`Refusing to build a storage session policy for an invalid bucket name '${bucket}'.`);\n }\n return bucket;\n}\n\nfunction assertPolicySafeApplicationId(applicationId: string): string {\n if (!/^[a-f0-9]{24}$/i.test(applicationId)) {\n throw new Error(\n 'Refusing to build a storage session policy for a non-ObjectId application id '\n + '— an unconstrained value could widen the policy resource and grant cross-application access.',\n );\n }\n return applicationId;\n}\n\nfunction assertPolicySafeStorageName(name: string): string {\n // Same reasoning as the two above: anything reaching a policy resource must be\n // shape-constrained, or a crafted name widens the grant.\n if (!/^[a-z0-9][a-z0-9_-]{0,62}$/i.test(name)) {\n throw new Error(`Refusing to build a storage session policy for an invalid storage name '${name}'.`);\n }\n return name;\n}\n\n/**\n * Build the inline session policy document.\n *\n * ## The `*applications/` collapse\n *\n * One pattern per confinement, not two. An application may author a\n * `bucketPrefix`, so a key is either `applications/<id>/…` or\n * `<authored>/applications/<id>/…`. This used to be covered by TWO entries; a\n * single leading `*` (which matches zero-or-more characters) covers both.\n *\n * That halves the policy — measured 308 → 154 characters per declared resource,\n * which against the 2048 ceiling is the difference between ~5 and ~12 resources.\n * At the two-entry size a plausible minion (todos, lists, tags, users,\n * organizations) is already at the limit, so this is a PREREQUISITE for\n * per-resource confinement rather than an optimisation.\n *\n * Accepted residual: `*applications/` also matches `…/xapplications/<id>/`, so\n * another application could deliberately place an object inside its OWN subtree at\n * a crafted path that this credential could read. That is one application choosing\n * to expose its own bytes — reachable by any other channel too — and the direction\n * that would matter (writing INTO another application's read path) stays closed,\n * because a writer can only produce keys containing its own id.\n *\n * ## Why it keys on `applicationId` and never on the authored prefix\n *\n * `applicationId` is platform-minted and the application cannot influence it. The\n * authored `bucketPrefix` is app-owned, so deriving the policy from it would let an\n * application move its own boundary — and would create a second, independently\n * updated copy of a value the client already derives for itself.\n *\n * ## Enumeration is confined separately\n *\n * A prefix on the object ARNs does not restrict `ListBucket`. Without the\n * `s3:prefix` condition below, a principal could enumerate every key in the bucket\n * — filenames, application ids, file ids — while unable to read any of them.\n *\n * NOTE `s3:ListBucketMultipartUploads` is deliberately absent: MinIO rejects\n * `s3:prefix` as a condition key for it outright, so it cannot be confined at all.\n * The storage provider avoids the multipart branch instead of authorising it.\n */\nexport function buildObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): string {\n const bucket = assertPolicySafeBucket(input.bucket);\n const applicationId = assertPolicySafeApplicationId(input.applicationId);\n const names = (input.storageNames ?? []).map(assertPolicySafeStorageName);\n\n const confinements = names.length > 0\n ? names.map((name) => `*applications/${applicationId}/files/${name}/`)\n : [`*applications/${applicationId}/`];\n\n return JSON.stringify({\n Version: '2012-10-17',\n Statement: [\n {\n Effect: 'Allow',\n Action: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject'],\n Resource: confinements.map((prefix) => `arn:aws:s3:::${bucket}/${prefix}*`),\n },\n {\n Effect: 'Allow',\n Action: ['s3:ListBucket'],\n Resource: [`arn:aws:s3:::${bucket}`],\n Condition: { StringLike: { 's3:prefix': confinements.map((prefix) => `${prefix}*`) } },\n },\n ],\n });\n}\n\n/**\n * Whether a declaration's policy would fit, and by how much.\n *\n * Exposed so a declaration validator measures the REAL document rather than\n * modelling its shape — the whole reason this module exists.\n */\nexport function measureObjectStorageSessionPolicy(input: ObjectStorageSessionPolicyInput): {\n characters: number;\n limit: number;\n fits: boolean;\n} {\n const characters = buildObjectStorageSessionPolicy(input).length;\n return { characters, limit: OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS, fits: characters <= OBJECT_STORAGE_SESSION_POLICY_MAX_CHARS };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-services.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"platform-services.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/platform-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,oBAAY,qBAAqB;IAC/B,aAAa,kBAAkB;IAC/B,YAAY,0BAA0B;IACtC,wBAAwB,sCAAsC;IAC9D;;;;OAIG;IACH,eAAe,6BAA6B;CAC7C;AA4BD,eAAO,MAAM,2BAA2B,kGAGyB,CAAC;AAElE,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpF;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAC1C,uBAAuB,CAAC,qBAAqB,GAC7C,uBAAuB,CAAC,iCAAiC,GACzD,uBAAuB,CAAC,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,kCAAkC,EAAE,qBAAqB,CAI3G,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,oBAAY,yBAAyB;IACnC,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,wBAAwB,6BAA6B;CACtD;AAED;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;;CAIgD,CAAC;AAc3F;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,yBAAyB,GAAG,SAAS,CAGvH;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,qBAAqB,GAAG,SAAS,CAGpH;AAeD,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-services.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/platform-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,qBAUX;AAVD,WAAY,qBAAqB;IAC/B,wDAA+B,CAAA;IAC/B,+DAAsC,CAAA;IACtC,uFAA8D,CAAA;IAC9D;;;;OAIG;IACH,qEAA4C,CAA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,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAChD,OAAQ,6BAAmF,CAAC,WAAW,CAAC,CAAC;AAC3G,CAAC;AAYD,MAAM,kCAAkC,GAAuC,IAAI,CAAC;AACpF,KAAK,kCAAkC,CAAC;AAExC,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["import { PlatformApplicationType } from '@wildo-ai/platform-core-shared';\n\n/**\n * Platform microservices. All use the same Docker image (wildo-platform)\n * differentiated at runtime via PLATFORM_SERVICE env var.\n *\n * For app developers: deployed as Docker containers.\n * For framework developers: run natively from source (hot-reload).\n */\nexport enum PlatformWildoServices {\n PLATFORM_INIT = 'platform-init',\n APPS_MANAGER = 'platform-apps-manager',\n CRONTABS_BATCHES_MANAGER = 'platform-crontabs-batches-manager',\n /**\n * Module-registry server (`platform-module-registry`, KD-7).\n * Hosts the central `wildo registry *` HTTP surface; pinned port\n * `PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY` (5154).\n */\n MODULE_REGISTRY = 'platform-module-registry',\n}\n\n/**\n * Bootstrap platform services — long-running platform microservices that boot\n * from the same env contract via `PlatformEnvVarsBuilder.buildBootstrapEnv`.\n *\n * Excludes:\n * - `PLATFORM_INIT` — one-shot initialization job, not a long-running service.\n * - `APPS_MANAGER` — has its own dedicated full-env builder\n * (`PlatformEnvVarsBuilder.buildAppsManagerFullEnv`) with extra wiring\n * (Atlas creds, GitHub provisioning keys, etc.).\n *\n * Single source of truth for everything that iterates \"all bootstrap services\":\n * K8s Secret/ConfigMap emit (`k8s-secrets-generator.service.ts`), Compose\n * runtime catalog, and tests asserting cross-service env contracts.\n *\n * The `satisfies` clause below forces this list to cover every member of\n * `PlatformWildoServices` other than the two explicitly excluded ones —\n * adding a new enum member without listing it here is a compile error.\n * Without that coupling, the previous `Exclude<…>`-based local type alias\n * silently widened to include any future enum member, which masked the\n * \"service in enum but not yet handled by the bootstrap path\" drift class.\n */\ntype BootstrapPlatformServiceCandidate = Exclude<\n PlatformWildoServices,\n PlatformWildoServices.PLATFORM_INIT | PlatformWildoServices.APPS_MANAGER\n>;\n\nexport const BOOTSTRAP_PLATFORM_SERVICES = [\n PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n PlatformWildoServices.MODULE_REGISTRY,\n] as const satisfies readonly BootstrapPlatformServiceCandidate[];\n\nexport type BootstrapPlatformService = (typeof BOOTSTRAP_PLATFORM_SERVICES)[number];\n\n/**\n * The platform-application TYPES the platform provisions credentials for — the same three the\n * apps-manager provisioner iterates. Named here so the runtime-slug ledger below can be REQUIRED per\n * member: a fourth provisioned service that is not mapped fails to compile before it provisions a\n * grant nobody can use.\n */\nexport type ProvisionedPlatformApplicationType =\n | PlatformApplicationType.PLATFORM_APPS_MANAGER\n | PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER\n | PlatformApplicationType.PLATFORM_MODULE_REGISTRY;\n\n/**\n * ONE service, TWO spellings — and this is the join between them.\n *\n * `PlatformApplicationType` (`platform_crontabs_batches_manager`, underscores) is the platform-\n * application RECORD type: the row in `platformApplications`, the Redis ACL USERNAME, the RabbitMQ\n * user. `PlatformWildoServices` (`platform-crontabs-batches-manager`, hyphens) is the RUNTIME SLUG:\n * the Docker/K8s service name and, since 2026-09-09, the `appSlug` each service process boots with.\n *\n * Why the join matters: every Redis key a platform process writes is rooted at its runtime slug —\n * the engine's `RedisService` roots at `${appSlug}:`, the platform's `PlatformRedisService` at the\n * same slug through this ledger — and the ACL grant minted for the service must therefore be\n * `~<runtime slug>:*`. Two writers rooted at the USERNAME instead (the provisioner's grant, then the\n * platform Redis service's prefix) each produced `NOPERM` on the service's first key, one after the\n * other, once the other side was corrected. Both sides now read this one table.\n */\nexport const PLATFORM_SERVICE_RUNTIME_SLUG: Record<ProvisionedPlatformApplicationType, PlatformWildoServices> = {\n [PlatformApplicationType.PLATFORM_APPS_MANAGER]: PlatformWildoServices.APPS_MANAGER,\n [PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER]: PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n [PlatformApplicationType.PLATFORM_MODULE_REGISTRY]: PlatformWildoServices.MODULE_REGISTRY,\n};\n\n/**\n * The platform-side JWT KEY NAME of a provisioned platform service — the property name under which\n * that service's signing keypair is stored in its platform secrets (`jwt.privateKey[<name>]`,\n * `jwt.publicKey[<name>]`) and under which its public key is PUBLISHED into the platform config's\n * `jwtPublicKeys`.\n *\n * ## Two concepts that share spellings, and must not be merged\n *\n * 1. **This vocabulary — every provisioned platform service's key name.** TOTAL by nature: every\n * service apps-manager provisions gets a keypair, so every one has a name. The platform-side\n * vocabularies (`PlatformJwtPrivateKeys` / `PlatformJwtPublicKeys` in `platform-shared-lib`) are\n * DERIVED from it, and every map from a service to its key name is keyed by\n * {@link ProvisionedPlatformApplicationType} and required per member.\n * 2. **`JwtPublicKeys` in `@wildo-ai/saas-models` — the platform services whose tokens APPLICATIONS\n * verify.** A deliberate SUBSET: module-registry signs nothing to an application, so it is not\n * there, and adding it would invent an issuer/audience verification nothing performs.\n * `platform-shared-lib` asserts at the type level that that subset stays inside this vocabulary.\n *\n * ## Why this is the ONE source\n *\n * Before #514 the same population was enumerated by hand in four places — two of them\n * `Partial<Record<…>>` maps that omitted module-registry. A `Partial` map is exactly the hand-copied\n * population that broke every fresh install when module-registry was added (see\n * `.claude/rules/invariant-call-site-enumeration.md` #21): it compiles with the member missing and\n * falls back to a key the service's secrets never hold.\n *\n * The string VALUES are persisted keys (platform secrets documents, published `jwtPublicKeys`) and\n * must never change spelling.\n */\nexport enum PlatformServiceJwtKeyName {\n PLATFORM_APPS_MANAGER = 'PLATFORM_APPS_MANAGER',\n PLATFORM_CRONTABS_BATCHES_MANAGER = 'PLATFORM_CRONTABS_BATCHES_MANAGER',\n PLATFORM_MODULE_REGISTRY = 'PLATFORM_MODULE_REGISTRY',\n}\n\n/**\n * Provisioned platform service → its platform-side JWT key name. Required for every member of\n * {@link ProvisionedPlatformApplicationType}, so a fourth provisioned service fails to compile here\n * until it is given a name.\n */\nexport const PLATFORM_SERVICE_JWT_KEY_NAME = {\n [PlatformApplicationType.PLATFORM_APPS_MANAGER]: PlatformServiceJwtKeyName.PLATFORM_APPS_MANAGER,\n [PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER]: PlatformServiceJwtKeyName.PLATFORM_CRONTABS_BATCHES_MANAGER,\n [PlatformApplicationType.PLATFORM_MODULE_REGISTRY]: PlatformServiceJwtKeyName.PLATFORM_MODULE_REGISTRY,\n} as const satisfies Record<ProvisionedPlatformApplicationType, PlatformServiceJwtKeyName>;\n\n/**\n * Compile-time assertion: every {@link PlatformServiceJwtKeyName} member is the key name of SOME\n * provisioned service. A name nothing maps to would be a vocabulary member no keypair is ever stored\n * under.\n */\ntype _AssertEveryJwtKeyNameIsMapped =\n Exclude<PlatformServiceJwtKeyName, (typeof PLATFORM_SERVICE_JWT_KEY_NAME)[ProvisionedPlatformApplicationType]> extends never\n ? true\n : never;\nconst _assertEveryJwtKeyNameIsMapped: _AssertEveryJwtKeyNameIsMapped = true;\nvoid _assertEveryJwtKeyNameIsMapped;\n\n/**\n * The platform-side JWT key name for a platform-application type name, or `undefined` when the name\n * is not a provisioned platform service. Callers holding a runtime string (a service's own\n * `serviceName`, an inbound service id) go through here rather than casting into the map.\n */\nexport function resolvePlatformServiceJwtKeyName(serviceName: string | undefined): PlatformServiceJwtKeyName | undefined {\n if (serviceName === undefined) return undefined;\n return (PLATFORM_SERVICE_JWT_KEY_NAME as Record<string, PlatformServiceJwtKeyName | undefined>)[serviceName];\n}\n\n/**\n * The runtime slug for a platform-application type name, or `undefined` when the name is not a\n * provisioned platform service — a caller then reports or refuses rather than rooting a key\n * namespace, or a grant, on a guess.\n */\nexport function resolvePlatformServiceRuntimeSlug(serviceName: string | undefined): PlatformWildoServices | undefined {\n if (serviceName === undefined) return undefined;\n return (PLATFORM_SERVICE_RUNTIME_SLUG as Record<string, PlatformWildoServices | undefined>)[serviceName];\n}\n\n/**\n * Compile-time assertion: every non-excluded `PlatformWildoServices` member\n * MUST appear in `BOOTSTRAP_PLATFORM_SERVICES`. Adding a new member to the\n * enum without listing it above triggers a `Type 'X' is not assignable to\n * type 'never'` error pointing here, so the exhaustiveness check the\n * `addServiceExtras` switch used to provide for `Exclude<…>`-derived types\n * is preserved.\n */\ntype _AssertExhaustiveBootstrapCoverage =\n Exclude<BootstrapPlatformServiceCandidate, BootstrapPlatformService> extends never ? true : never;\nconst _assertExhaustiveBootstrapCoverage: _AssertExhaustiveBootstrapCoverage = true;\nvoid _assertExhaustiveBootstrapCoverage;\n\nexport enum AppsManagerMode {\n NORMAL = 'normal',\n INIT = 'init',\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"platform-services.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/platform-services.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,qBAUX;AAVD,WAAY,qBAAqB;IAC/B,wDAA+B,CAAA;IAC/B,+DAAsC,CAAA;IACtC,uFAA8D,CAAA;IAC9D;;;;OAIG;IACH,qEAA4C,CAAA;AAC9C,CAAC,EAVW,qBAAqB,KAArB,qBAAqB,QAUhC;AA4BD,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,qBAAqB,CAAC,wBAAwB;IAC9C,qBAAqB,CAAC,eAAe;CAC0B,CAAC;AAelE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAsE;IAC9G,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,YAAY;IACnF,CAAC,uBAAuB,CAAC,iCAAiC,CAAC,EAAE,qBAAqB,CAAC,wBAAwB;IAC3G,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,qBAAqB,CAAC,eAAe;CAC1F,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAN,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,4EAA+C,CAAA;IAC/C,oGAAuE,CAAA;IACvE,kFAAqD,CAAA;AACvD,CAAC,EAJW,yBAAyB,KAAzB,yBAAyB,QAIpC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,yBAAyB,CAAC,qBAAqB;IAChG,CAAC,uBAAuB,CAAC,iCAAiC,CAAC,EAAE,yBAAyB,CAAC,iCAAiC;IACxH,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,EAAE,yBAAyB,CAAC,wBAAwB;CACd,CAAC;AAW3F,MAAM,8BAA8B,GAAmC,IAAI,CAAC;AAC5E,KAAK,8BAA8B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,WAA+B;IAC9E,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAChD,OAAQ,6BAAuF,CAAC,WAAW,CAAC,CAAC;AAC/G,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,WAA+B;IAC/E,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAChD,OAAQ,6BAAmF,CAAC,WAAW,CAAC,CAAC;AAC3G,CAAC;AAYD,MAAM,kCAAkC,GAAuC,IAAI,CAAC;AACpF,KAAK,kCAAkC,CAAC;AAExC,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["import { PlatformApplicationType } from '@wildo-ai/platform-core-shared';\n\n/**\n * Platform microservices. All use the same Docker image (wildo-platform)\n * differentiated at runtime via PLATFORM_SERVICE env var.\n *\n * For app developers: deployed as Docker containers.\n * For framework developers: run natively from source (hot-reload).\n */\nexport enum PlatformWildoServices {\n PLATFORM_INIT = 'platform-init',\n APPS_MANAGER = 'platform-apps-manager',\n CRONTABS_BATCHES_MANAGER = 'platform-crontabs-batches-manager',\n /**\n * Module-registry server (`platform-module-registry`, KD-7).\n * Hosts the central `wildo registry *` HTTP surface; pinned port\n * `PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY` (5154).\n */\n MODULE_REGISTRY = 'platform-module-registry',\n}\n\n/**\n * Bootstrap platform services — long-running platform microservices that boot\n * from the same env contract via `PlatformEnvVarsBuilder.buildBootstrapEnv`.\n *\n * Excludes:\n * - `PLATFORM_INIT` — one-shot initialization job, not a long-running service.\n * - `APPS_MANAGER` — has its own dedicated full-env builder\n * (`PlatformEnvVarsBuilder.buildAppsManagerFullEnv`) with extra wiring\n * (Atlas creds, GitHub provisioning keys, etc.).\n *\n * Single source of truth for everything that iterates \"all bootstrap services\":\n * K8s Secret/ConfigMap emit (`k8s-secrets-generator.service.ts`), Compose\n * runtime catalog, and tests asserting cross-service env contracts.\n *\n * The `satisfies` clause below forces this list to cover every member of\n * `PlatformWildoServices` other than the two explicitly excluded ones —\n * adding a new enum member without listing it here is a compile error.\n * Without that coupling, the previous `Exclude<…>`-based local type alias\n * silently widened to include any future enum member, which masked the\n * \"service in enum but not yet handled by the bootstrap path\" drift class.\n */\ntype BootstrapPlatformServiceCandidate = Exclude<\n PlatformWildoServices,\n PlatformWildoServices.PLATFORM_INIT | PlatformWildoServices.APPS_MANAGER\n>;\n\nexport const BOOTSTRAP_PLATFORM_SERVICES = [\n PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n PlatformWildoServices.MODULE_REGISTRY,\n] as const satisfies readonly BootstrapPlatformServiceCandidate[];\n\nexport type BootstrapPlatformService = (typeof BOOTSTRAP_PLATFORM_SERVICES)[number];\n\n/**\n * The platform-application TYPES the platform provisions credentials for — the same three the\n * apps-manager provisioner iterates. Named here so the runtime-slug ledger below can be REQUIRED per\n * member: a fourth provisioned service that is not mapped fails to compile before it provisions a\n * grant nobody can use.\n */\nexport type ProvisionedPlatformApplicationType =\n | PlatformApplicationType.PLATFORM_APPS_MANAGER\n | PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER\n | PlatformApplicationType.PLATFORM_MODULE_REGISTRY;\n\n/**\n * ONE service, TWO spellings — and this is the join between them.\n *\n * `PlatformApplicationType` (`platform_crontabs_batches_manager`, underscores) is the platform-\n * application RECORD type: the row in `platformApplications`, the Redis ACL USERNAME, the RabbitMQ\n * user. `PlatformWildoServices` (`platform-crontabs-batches-manager`, hyphens) is the RUNTIME SLUG:\n * the Docker/K8s service name and, since 2026-09-09, the `appSlug` each service process boots with.\n *\n * Why the join matters: every Redis key a platform process writes is rooted at its runtime slug —\n * the engine's `RedisService` roots at `${appSlug}:`, the platform's `PlatformRedisService` at the\n * same slug through this ledger — and the ACL grant minted for the service must therefore be\n * `~<runtime slug>:*`. Two writers rooted at the USERNAME instead (the provisioner's grant, then the\n * platform Redis service's prefix) each produced `NOPERM` on the service's first key, one after the\n * other, once the other side was corrected. Both sides now read this one table.\n */\nexport const PLATFORM_SERVICE_RUNTIME_SLUG: Record<ProvisionedPlatformApplicationType, PlatformWildoServices> = {\n [PlatformApplicationType.PLATFORM_APPS_MANAGER]: PlatformWildoServices.APPS_MANAGER,\n [PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER]: PlatformWildoServices.CRONTABS_BATCHES_MANAGER,\n [PlatformApplicationType.PLATFORM_MODULE_REGISTRY]: PlatformWildoServices.MODULE_REGISTRY,\n};\n\n/**\n * The platform-side JWT KEY NAME of a provisioned platform service — the property name under which\n * that service's signing keypair is stored in its platform secrets (`jwt.privateKey[<name>]`,\n * `jwt.publicKey[<name>]`) and under which its public key is PUBLISHED into the platform config's\n * `jwtPublicKeys`.\n *\n * ## Two concepts that share spellings, and must not be merged\n *\n * 1. **This vocabulary — every provisioned platform service's key name.** TOTAL by nature: every\n * service apps-manager provisions gets a keypair, so every one has a name. The platform-side\n * vocabularies (`PlatformJwtPrivateKeys` / `PlatformJwtPublicKeys` in `platform-shared-lib`) are\n * DERIVED from it, and every map from a service to its key name is keyed by\n * {@link ProvisionedPlatformApplicationType} and required per member.\n * 2. **`JwtPublicKeys` in `@wildo-ai/saas-models` — the platform services whose tokens APPLICATIONS\n * verify.** A deliberate SUBSET: module-registry signs nothing to an application, so it is not\n * there, and adding it would invent an issuer/audience verification nothing performs.\n * `platform-shared-lib` asserts at the type level that that subset stays inside this vocabulary.\n *\n * ## Why this is the ONE source\n *\n * Before #514 the same population was enumerated by hand in four places — two of them\n * `Partial<Record<…>>` maps that omitted module-registry. A `Partial` map is exactly the hand-copied\n * population that broke every fresh install when module-registry was added (see\n * `.claude/rules/invariant-call-site-enumeration.md` #21): it compiles with the member missing and\n * falls back to a key the service's secrets never hold.\n *\n * The string VALUES are persisted keys (platform secrets documents, published `jwtPublicKeys`) and\n * must never change spelling.\n */\nexport enum PlatformServiceJwtKeyName {\n PLATFORM_APPS_MANAGER = 'PLATFORM_APPS_MANAGER',\n PLATFORM_CRONTABS_BATCHES_MANAGER = 'PLATFORM_CRONTABS_BATCHES_MANAGER',\n PLATFORM_MODULE_REGISTRY = 'PLATFORM_MODULE_REGISTRY',\n}\n\n/**\n * Provisioned platform service → its platform-side JWT key name. Required for every member of\n * {@link ProvisionedPlatformApplicationType}, so a fourth provisioned service fails to compile here\n * until it is given a name.\n */\nexport const PLATFORM_SERVICE_JWT_KEY_NAME = {\n [PlatformApplicationType.PLATFORM_APPS_MANAGER]: PlatformServiceJwtKeyName.PLATFORM_APPS_MANAGER,\n [PlatformApplicationType.PLATFORM_CRONTABS_BATCHES_MANAGER]: PlatformServiceJwtKeyName.PLATFORM_CRONTABS_BATCHES_MANAGER,\n [PlatformApplicationType.PLATFORM_MODULE_REGISTRY]: PlatformServiceJwtKeyName.PLATFORM_MODULE_REGISTRY,\n} as const satisfies Record<ProvisionedPlatformApplicationType, PlatformServiceJwtKeyName>;\n\n/**\n * Compile-time assertion: every {@link PlatformServiceJwtKeyName} member is the key name of SOME\n * provisioned service. A name nothing maps to would be a vocabulary member no keypair is ever stored\n * under.\n */\ntype _AssertEveryJwtKeyNameIsMapped =\n Exclude<PlatformServiceJwtKeyName, (typeof PLATFORM_SERVICE_JWT_KEY_NAME)[ProvisionedPlatformApplicationType]> extends never\n ? true\n : never;\nconst _assertEveryJwtKeyNameIsMapped: _AssertEveryJwtKeyNameIsMapped = true;\nvoid _assertEveryJwtKeyNameIsMapped;\n\n/**\n * The platform-side JWT key name for a platform-application type name, or `undefined` when the name\n * is not a provisioned platform service. Callers holding a runtime string (a service's own\n * `serviceName`, an inbound service id) go through here rather than casting into the map.\n */\nexport function resolvePlatformServiceJwtKeyName(serviceName: string | undefined): PlatformServiceJwtKeyName | undefined {\n if (serviceName === undefined) return undefined;\n return (PLATFORM_SERVICE_JWT_KEY_NAME as Record<string, PlatformServiceJwtKeyName | undefined>)[serviceName];\n}\n\n/**\n * The runtime slug for a platform-application type name, or `undefined` when the name is not a\n * provisioned platform service — a caller then reports or refuses rather than rooting a key\n * namespace, or a grant, on a guess.\n */\nexport function resolvePlatformServiceRuntimeSlug(serviceName: string | undefined): PlatformWildoServices | undefined {\n if (serviceName === undefined) return undefined;\n return (PLATFORM_SERVICE_RUNTIME_SLUG as Record<string, PlatformWildoServices | undefined>)[serviceName];\n}\n\n/**\n * Compile-time assertion: every non-excluded `PlatformWildoServices` member\n * MUST appear in `BOOTSTRAP_PLATFORM_SERVICES`. Adding a new member to the\n * enum without listing it above triggers a `Type 'X' is not assignable to\n * type 'never'` error pointing here, so the exhaustiveness check the\n * `addServiceExtras` switch used to provide for `Exclude<…>`-derived types\n * is preserved.\n */\ntype _AssertExhaustiveBootstrapCoverage =\n Exclude<BootstrapPlatformServiceCandidate, BootstrapPlatformService> extends never ? true : never;\nconst _assertExhaustiveBootstrapCoverage: _AssertExhaustiveBootstrapCoverage = true;\nvoid _assertExhaustiveBootstrapCoverage;\n\nexport enum AppsManagerMode {\n NORMAL = 'normal',\n INIT = 'init',\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-storage.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"platform-storage.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/platform-storage.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gCAAgC;IAC3C,uFAAuF;;kBAEvF,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,sGAAsG;AACtG,wBAAgB,kCAAkC,CAAC,eAAe,EAAE,0BAA0B,GAAG,SAAS,GAAG,MAAM,CAElH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-storage.schemas.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"platform-storage.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/platform-storage.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7D,uFAAuF;IACvF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1B,CAAC,CAAC;AAGH,sGAAsG;AACtG,MAAM,UAAU,kCAAkC,CAAC,eAAuD;IACxG,OAAO,eAAe,EAAE,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC;AAC5D,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { STORAGE_DEFAULTS } from './infrastructure-defaults.schemas';\n\n/**\n * The PLATFORM tier's own object-storage bucket, authored for a remote environment (#1112).\n *\n * ## Why the platform needs its own, separate from `backingServices.s3.bucket`\n *\n * `backingServices.s3.bucket` is an APPLICATION's bucket: its backend reads and writes there, and apps-manager\n * confines that application's storage credential to it (#1107). The platform services — apps-manager itself and\n * module-registry — store their own objects too, and both halves of that pair must address ONE bucket: the\n * platform-services STS door confines to the bucket apps-manager's env names, while module-registry addresses\n * objects in the bucket its own env names.\n *\n * Until #1112 the CLI rendered that platform bucket from the `config.json` of whichever application was being\n * registered or deployed, so it became the last-registered application's bucket, and platform objects written\n * earlier went out of reach. Measured on 2026-09-14: module-registry's uploads sat in `wonder-todos-local`, and\n * registering a second application rewrote every platform service's env to that application's bucket.\n *\n * ## Local: a constant. Remote: authored.\n *\n * A local platform is shared by every application checked out beside it, and no configuration on disk is shared\n * across them — every infra file, `config.json` and `secrets.json` belongs to one application. So a local\n * platform's bucket is the constant {@link STORAGE_DEFAULTS.BUCKET}, and authoring this block in a local\n * environment is refused at parse time (the same shape as `cdn`, which is remote-only for its own reason).\n *\n * A remote environment is deployed from one application's infra file and may need a globally unique S3 name, so\n * it can author one here. Absent, the constant applies there too.\n */\nexport const WildoPlatformStorageConfigSchema = z.strictObject({\n /** The bucket apps-manager and module-registry store the platform's own objects in. */\n bucket: z.string().min(1),\n});\nexport type WildoPlatformStorageConfig = z.infer<typeof WildoPlatformStorageConfigSchema>;\n\n/** The platform tier's bucket: the authored remote override, else {@link STORAGE_DEFAULTS.BUCKET}. */\nexport function resolvePlatformObjectStorageBucket(platformStorage: WildoPlatformStorageConfig | undefined): string {\n return platformStorage?.bucket ?? STORAGE_DEFAULTS.BUCKET;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"schema-version.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/schema-version.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,aAGpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.schemas.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"schema-version.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/schema-version.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,cAAc,GAAG,qLAAqL,CAAC;AAE7M;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACtD,cAAc,EACd,8EAA8E,CAC/E,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * Canonical SemVer 2.0.0 regex from https://semver.org (the \"official\"\n * suggested regex; identical to the snippet published in the\n * `Is there a suggested regular expression (RegEx) to check a SemVer string?`\n * FAQ entry).\n *\n * Captures `MAJOR.MINOR.PATCH` plus optional `-prerelease` and\n * `+buildmetadata` segments. Used as the strict shape for the\n * `WildoSaasConfig.version` and `WildoInfraEnvConfig.version` fields\n * (Slice 3.5; backlog **D-5** for the migration tooling that will\n * actually consume the value).\n *\n * Strictness rationale:\n * - We could accept `'1'` or `'1.0'` to be lenient, but the field is\n * a forward-compatibility reservation — when the migration tooling\n * ships under D-5 it MUST be able to compare two versions\n * deterministically. Accepting partial semver shapes today would\n * create migration ambiguity later (`'1'` vs `'1.0.0'` — same? newer?\n * older?). Strict from day one keeps the contract honest.\n * - Pre-release / build-metadata are accepted because they are part of\n * the SemVer 2.0.0 spec; if migration tooling ever needs to reject\n * them it can layer a stricter check on top without re-shaping the\n * schema.\n */\nconst SEMVER_PATTERN = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Semver-string schema for the `version` field on\n * `WildoSaasConfigSchema` and `WildoInfraEnvConfigInputSchema`.\n *\n * Always `.optional()` at the call site — see the `@unimplemented` D-5\n * JSDoc on each schema field for the warner contract (silence when\n * unauthored, loud warn when explicit).\n *\n * The error message names the format and shows a canonical example so\n * authors who hit it can fix their config without grepping for the\n * regex source.\n */\nexport const WildoSchemaVersionSchema = z.string().regex(\n SEMVER_PATTERN,\n 'must be a SemVer 2.0.0 string (e.g. \"1.0.0\", \"2.3.1-rc.1\", \"1.0.0+build.42\")',\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"service-definitions.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/service-definitions.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,oBAAY,cAAc;IACxB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,sCAAuC,CAAC;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE;;;;;;;;;GASG;AACH,eAAO,MAAM,+B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AC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF,eAAO,MAAM,0BAA0B;;;kBAG5B,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAI3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY;;kBAEvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.schemas.js","sourceRoot":"","sources":["../../../../src/project-config/shared/service-definitions.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;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AE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnE,CAAC,CAAC;AAGH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { WildoCspConfigSchema } from './csp.schemas';\n\n/**\n * `AppFrontendType` lives in `@wildo-ai/saas-models/public-runtime` so the\n * backend's `FrontendServiceDefinitionSchema` (`@wildo-ai/saas-models`) and\n * client-bundle consumers (website discovery, scaffolding, CSP config,\n * companion services) can read the same enum without booting the heavy\n * decorator-bound schema graph. The atom is imported from the\n * `/public-runtime` subpath (NOT the package root barrel) so this file\n * stays free of `initZodDecorators()` side effects — `import { z } from 'zod'`\n * only, plus one decorator-free public-runtime import.\n *\n * The re-export below preserves every existing\n * `import { AppFrontendType } from '@wildo-ai/platform-config-lib'` call site\n * unchanged. Single source of truth (`@wildo-ai/saas-models`) with the\n * original public surface preserved.\n *\n * For the kind-by-kind taxonomy (`SAAS_APP` / `STATIC_WEBSITE` / `TECH_DOC`)\n * and the locked \"no native variants\" design decision, see the file-level\n * JSDoc in `engine/saas-models/src/config/app-frontend-type.shared.schemas.ts`\n * — that is the canonical home; do NOT duplicate the explanation here.\n */\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\n\nexport { AppFrontendType };\n\nexport enum AppLibraryType {\n FULLSTACK = 'fullstack',\n FRONTEND = 'frontend',\n BACKEND = 'backend',\n}\n\n/**\n * How the receiving frontend stores the JWT pair after a cross-frontend\n * handoff exchange (`cross-app-jwt-propagation.md` K-4).\n *\n * - `'ephemeral'` (default) → `EphemeralSessionTokenStorage` (in-memory,\n * dies with the tab). Avoids token poisoning when the source frontend\n * already holds a persistent session, and matches the existing W7.3b\n * `Auth_OneOffSession` guard that refuses non-`Ephemeral` storage.\n * Correct default for `TECH_DOC`, for secondary `SAAS_APP` surfaces\n * (e.g., an admin console reached by handoff from a primary app),\n * and for `STATIC_WEBSITE` (which never stores tokens anyway).\n * - `'persistent'` → `PersistentSessionTokenStorage` (localStorage).\n * Opt-in for the primary `SAAS_APP` surface where the user expects\n * their session to survive a tab close. Each service authors this\n * explicitly; there is no auto-derivation from `frontendType`\n * because a project can have multiple `SAAS_APP` services where\n * only one is \"primary\".\n */\nexport const APP_SESSION_STORAGES = ['persistent', 'ephemeral'] as const;\nexport type AppSessionStorage = (typeof APP_SESSION_STORAGES)[number];\n\n/**\n * The writable mount every containerised app runtime gets, unconditionally.\n *\n * Shared by minions and workers rather than defined twice: it is paired with\n * `readOnlyRootFilesystem: true` in both renderers, and two copies of a path this\n * load-bearing WILL drift. For minions the pairing is acute — the file liveness\n * heartbeat is written here, so separating them restart-loops healthy pods — and\n * while workers probe over HTTP instead, a read-only rootfs with nowhere to write\n * a temp file is its own failure, arriving later and less legibly.\n */\nexport const RUNTIME_MANDATORY_WRITABLE_PATH = '/tmp';\n\n/**\n * Container isolation knobs an app runtime (minion or worker) may author.\n *\n * ## What is deliberately ABSENT\n *\n * The security floor — `runAsNonRoot`, `readOnlyRootFilesystem`,\n * `allowPrivilegeEscalation: false`, `capabilities: drop [ALL]`,\n * `seccompProfile`, `automountServiceAccountToken: false` — is emitted\n * unconditionally by the renderers and cannot be authored down. A config key\n * that turns off root-filesystem protection is a bypass wearing a settings hat;\n * lowering the floor must be a deliberate schema change under review.\n *\n * ## What IS authorable, and why each earns it\n *\n * - `runAsUser` / `runAsGroup` — image-dependent, and demonstrably so: Wonder\n * Todos' Node worker runs as uid 1000 (`USER node`) while its Rust worker uses\n * distroless `nonroot` at uid 65532. No single default is correct, and a wrong\n * uid with `runAsNonRoot: true` means the kubelet refuses to start the\n * container.\n * - `writablePaths` — ADDITIVE only, on top of the always-present\n * {@link RUNTIME_MANDATORY_WRITABLE_PATH}. It can grant writability, never\n * remove it, so it cannot weaken the read-only rootfs.\n * - `pidsLimit` — a fork-bomb ceiling; purely a bound.\n */\nexport const RUNTIME_DEFAULT_PIDS_LIMIT = 512;\n\n/**\n * The field CONSTRAINTS, defined once and shared by the two isolation schemas\n * below so a validation rule cannot hold on one and not the other.\n *\n * `runAsUser`/`runAsGroup` are `.positive()` because 0 is root — the identity\n * the whole floor exists to forbid — and a schema that accepts it would let a\n * config re-enable root while `runAsNonRoot: true` is still emitted, producing a\n * container the kubelet refuses for a reason the config never mentions.\n */\nconst runtimeIsolationFields = {\n runAsUser: z.number().int().positive(),\n runAsGroup: z.number().int().positive(),\n writablePaths: z.array(z.string().min(1).startsWith('/')),\n pidsLimit: z.number().int().positive(),\n};\n\nexport const RuntimeIsolationSchema = z.strictObject({\n runAsUser: runtimeIsolationFields.runAsUser.default(10001),\n runAsGroup: runtimeIsolationFields.runAsGroup.default(10001),\n writablePaths: runtimeIsolationFields.writablePaths.default([]),\n pidsLimit: runtimeIsolationFields.pidsLimit.default(RUNTIME_DEFAULT_PIDS_LIMIT),\n});\n\n/**\n * The AUTHORED form: every knob optional and — critically — carrying NO default.\n *\n * This is not the same thing as `RuntimeIsolationSchema.partial()`, and the\n * difference is a real defect rather than a style point. `.partial()` only makes\n * a field optional; the inner `.default(10001)` still FIRES, so an authored\n * `isolation: { runAsUser: 101 }` parses to a `runAsGroup` of 10001 and the\n * caller can no longer tell \"authored 10001\" from \"authored nothing\". For a\n * service row that difference decides which account the container runs as, and\n * the wrong answer is a pod that never starts.\n *\n * Caught by the pin `honours an authored image-dependent uid…` in\n * `service-definitions.schemas.test.ts`, which was written expecting the kind\n * default and got 10001.\n */\nexport const AuthoredRuntimeIsolationSchema = z.strictObject({\n runAsUser: runtimeIsolationFields.runAsUser.optional(),\n runAsGroup: runtimeIsolationFields.runAsGroup.optional(),\n writablePaths: runtimeIsolationFields.writablePaths.optional(),\n pidsLimit: runtimeIsolationFields.pidsLimit.optional(),\n});\nexport type AuthoredRuntimeIsolation = z.infer<typeof AuthoredRuntimeIsolationSchema>;\nexport type RuntimeIsolation = z.infer<typeof RuntimeIsolationSchema>;\n\n/**\n * Shared `superRefine` body for an authored isolation block.\n *\n * `RUNTIME_MANDATORY_WRITABLE_PATH` is mounted by the renderers, so authoring it\n * again emits two volumeMounts on one mountPath — which Kubernetes rejects at\n * admission, meaning the pod never starts and the error names a duplicate mount\n * rather than the config line that caused it. Caught here, where the message can\n * point at the authored value.\n */\nexport function refineRuntimeIsolation(\n isolation: RuntimeIsolation,\n ctx: z.RefinementCtx,\n path: readonly (string | number)[] = ['isolation'],\n): void {\n const mandatory = isolation.writablePaths.filter(\n (p) => p === RUNTIME_MANDATORY_WRITABLE_PATH || p === `${RUNTIME_MANDATORY_WRITABLE_PATH}/`,\n );\n if (mandatory.length > 0) {\n ctx.addIssue({\n code: 'custom',\n path: [...path, 'writablePaths'],\n message:\n `'${RUNTIME_MANDATORY_WRITABLE_PATH}' is always mounted — remove it from writablePaths, which is `\n + 'for ADDITIONAL scratch mounts only. Authoring it twice emits two volumeMounts on one '\n + 'mountPath and Kubernetes refuses the pod.',\n });\n }\n\n const seen = new Set<string>();\n for (const p of isolation.writablePaths) {\n if (seen.has(p)) {\n ctx.addIssue({\n code: 'custom',\n path: [...path, 'writablePaths'],\n message: `Duplicate writable path '${p}' — same duplicate-mountPath rejection as above.`,\n });\n }\n seen.add(p);\n }\n}\n\n/**\n * The uid/gid an application BACKEND container runs as when nothing is authored.\n *\n * 1001 is not arbitrary and not new: `templates/infra/docker-images/platform/\n * Dockerfile.platform-base` has created `wildo` at 1001 and ended on `USER wildo`\n * since the platform images were written. Reusing it makes the app backend match\n * the convention the framework already ships rather than inventing a third number\n * beside the minion/worker 10001.\n *\n * The paired obligation lives in `Dockerfile.backend-base`: an image whose files\n * are owned by root and whose `USER` is root will be REFUSED by the kubelet under\n * `runAsNonRoot: true`. Schema default and image must move together.\n */\nexport const APP_BACKEND_DEFAULT_RUNTIME_UID = 1001;\n\n/**\n * The uid/gid an application FRONTEND container runs as when nothing is authored.\n *\n * 101 is the `nginx` account in `nginx:1.27-alpine` (verified by running the\n * image, not assumed). Every Wildo frontend is a static bundle served by nginx —\n * the framework mandates that runtime — so defaulting to any other uid would make\n * \"authored nothing\" the broken case, which is exactly the case that must come\n * out working.\n */\nexport const APP_FRONTEND_DEFAULT_RUNTIME_UID = 101;\n\n/**\n * ## Why the frontend container port is NOT changed, measured rather than assumed\n *\n * The obvious reasoning — \"the floor drops ALL capabilities, so a non-root nginx\n * cannot bind :80 without `CAP_NET_BIND_SERVICE`\" — is FALSE in a container, and\n * an earlier revision of this file asserted it in JSDoc before anyone ran it.\n *\n * Docker and containerd both set `net.ipv4.ip_unprivileged_port_start=0` inside\n * the container's network namespace, so ports below 1024 are not privileged there\n * at all. Measured against `nginx:1.27-alpine`: `cat\n * /proc/sys/net/ipv4/ip_unprivileged_port_start` prints `0`, and nginx running as\n * uid 101 with a read-only rootfs and no capabilities serves HTTP 200 on :80.\n *\n * So the frontends keep `listen 80` and the Service keeps `targetPort: 80`. No\n * nginx config, Dockerfile `EXPOSE`, Service or Traefik router changes are part\n * of this floor. What nginx DOES need is\n * {@link APP_FRONTEND_MANDATORY_WRITABLE_PATHS} — see there.\n */\n\n/**\n * Writable mounts an nginx frontend needs BEYOND\n * {@link RUNTIME_MANDATORY_WRITABLE_PATH}, emitted unconditionally rather than\n * authored.\n *\n * They are not additive author choices — they are what the runtime the framework\n * MANDATES cannot start without, measured against `nginx:1.27-alpine`:\n *\n * - `/var/cache/nginx` — the parent of `client_temp`/`proxy_temp`/… . Present in\n * the image but owned by `root:root` 0755, so a non-root master cannot create\n * the temp directories inside it.\n * - `/run` — where the stock `nginx.conf` writes `nginx.pid` (`/var/run` is a\n * symlink to it). Root-owned, so the pid write fails and nginx exits.\n *\n * Mounting them as writable volumes is preferred over `chown`-ing in every\n * application's Dockerfile: it keeps the requirement in the framework's runtime\n * spec, where it is emitted once and cannot be forgotten per app.\n */\nexport const APP_FRONTEND_MANDATORY_WRITABLE_PATHS: readonly string[] = ['/var/cache/nginx', '/run'];\n\n/**\n * Resolve a service row's effective container isolation.\n *\n * THE reason this exists as a function rather than a schema default: the correct\n * default depends on the container KIND, and a Zod field default cannot see its\n * sibling `frontendType`. Two renderers consume this (k8s manifests and the\n * compose app lane) and they must not each apply their own fallback — that is how\n * a k8s pod and a compose container end up running as different users from one\n * config row.\n *\n * Frontend rows additionally receive {@link APP_FRONTEND_MANDATORY_WRITABLE_PATHS}\n * prepended, because nginx cannot start without them. They are prepended rather\n * than appended so an author reading the rendered manifest sees the framework's\n * mounts first, and deduplicated against the authored list so re-authoring one is\n * tolerated here (unlike `/tmp`, these are nginx implementation detail rather\n * than a documented contract, so a duplicate is a mistake worth absorbing instead\n * of a config error worth failing on).\n */\nexport function resolveAppServiceIsolation(\n service: Pick<AppServiceDefinition, 'frontendType'> & { isolation?: Partial<RuntimeIsolation> },\n): RuntimeIsolation {\n const isFrontend = service.frontendType !== undefined;\n const defaultUid = isFrontend ? APP_FRONTEND_DEFAULT_RUNTIME_UID : APP_BACKEND_DEFAULT_RUNTIME_UID;\n const authoredPaths = service.isolation?.writablePaths ?? [];\n const mandatory = isFrontend ? APP_FRONTEND_MANDATORY_WRITABLE_PATHS : [];\n\n return {\n runAsUser: service.isolation?.runAsUser ?? defaultUid,\n runAsGroup: service.isolation?.runAsGroup ?? defaultUid,\n writablePaths: [...mandatory, ...authoredPaths.filter((p) => !mandatory.includes(p))],\n pidsLimit: service.isolation?.pidsLimit ?? RUNTIME_DEFAULT_PIDS_LIMIT,\n };\n}\n\n/**\n * One service inside `wildo.saas.config.ts` `services` map.\n *\n * `sessionStorage` (default `'ephemeral'`) is the per-service explicit\n * opt-in to localStorage; the default matches the non-primary-surface\n * common case. See `APP_SESSION_STORAGES` JSDoc for the rationale.\n *\n * `csp?` lives here only for `frontendType: SAAS_APP`. Unlike\n * `STATIC_WEBSITE` / `TECH_DOC`, the main app currently has no\n * engine-owned per-service config file (`wildo.website.config.ts` /\n * `wildo.tech-doc.config.ts`) — the service row itself is therefore the\n * honest app-static authoring seam for SPA-specific posture such as CSP.\n * Non-app services MUST reject authored `csp` here to preserve the\n * semantic split between the generic service declaration and the\n * website/docs engine-owned config files.\n *\n * No host-binding or public-URL authoring on this schema. The public\n * hostname per service is authored per-environment in\n * `infra.serviceHosts` — that seam is in `define-infra-env-config.ts`\n * and is intentionally decoupled from `frontendType` and from the\n * service key so the app developer can map any service to any host\n * (e.g. `services.docs` published at `dev.example.com`).\n */\nexport const AppServiceDefinitionSchema = z.strictObject({\n path: z.string().min(1),\n serviceName: z.string().min(1),\n defaultPort: z.number().int().positive().optional(),\n frontendType: z.enum(AppFrontendType).optional(),\n sessionStorage: z.enum(APP_SESSION_STORAGES).default('ephemeral'),\n csp: WildoCspConfigSchema.optional(),\n /**\n * Container isolation — the same contract minions and workers carry, applied to\n * the two container kinds that had none: the app backend and each frontend.\n *\n * `.optional()` here, unlike the minion/worker `.prefault({})`, because the\n * correct DEFAULT depends on the kind and the kind is not known until the row\n * is read: a backend runs Node as {@link APP_BACKEND_DEFAULT_RUNTIME_UID}, a\n * frontend runs nginx as {@link APP_FRONTEND_DEFAULT_RUNTIME_UID}. Emitting one\n * number for both would hand half the services a uid their image does not\n * define. Callers resolve it through {@link resolveAppServiceIsolation}, which\n * is where \"authored nothing\" becomes a hardened value — never at a renderer,\n * so the two renderers cannot disagree.\n *\n * The floor is absent for the same reason it is absent from the minion and\n * worker schemas: it is emitted unconditionally and must not be authorable\n * down. See {@link RuntimeIsolationSchema}.\n */\n isolation: AuthoredRuntimeIsolationSchema.optional(),\n}).superRefine((service, ctx) => {\n if (service.isolation) {\n refineRuntimeIsolation(resolveAppServiceIsolation(service), ctx);\n }\n if (service.csp !== undefined && service.frontendType !== AppFrontendType.SAAS_APP) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp'],\n message:\n 'services.<key>.csp is only supported for `frontendType: SAAS_APP`. '\n + 'STATIC_WEBSITE and TECH_DOC services must author CSP in their per-service '\n + '`wildo.website.config.ts` / `wildo.tech-doc.config.ts` files, and '\n + 'non-frontend services cannot ship a document CSP.',\n });\n }\n});\nexport type AppServiceDefinition = z.infer<typeof AppServiceDefinitionSchema>;\nexport type AppServiceDefinitionInput = z.input<typeof AppServiceDefinitionSchema>;\n\nexport const AppLibraryDefinitionSchema = z.object({\n path: z.string().min(1),\n type: z.enum(AppLibraryType),\n}).strict();\nexport type AppLibraryDefinition = z.infer<typeof AppLibraryDefinitionSchema>;\n\nexport const WorkerRuntimeSchema = z.object({\n type: z.string().min(1),\n language: z.string().min(1),\n});\nexport type WorkerRuntime = z.infer<typeof WorkerRuntimeSchema>;\n\nexport const ResourceLimitsSchema = z.object({\n cpu: z.string().min(1).optional(),\n memory: z.string().min(1).optional(),\n});\nexport type ResourceLimits = z.infer<typeof ResourceLimitsSchema>;\n\nexport const DataAccessSchema = z.object({\n database: z.enum(['read-only', 'read-write', 'none']).optional(),\n cache: z.boolean().optional(),\n queue: z.enum(['consumer', 'producer', 'both', 'none']).optional(),\n});\nexport type DataAccess = z.infer<typeof DataAccessSchema>;\n\n/**\n * Minimal \"I live at this path\" reference for a per-folder app sub-config\n * (`wildo.minion.config.ts`, `wildo.worker.config.ts`, `wildo.specifications.config.ts`).\n *\n * Tightened to `z.strictObject` (M-3 in\n * `.cursor/plans/minions-and-workers-implementation.md`) so authoring an\n * unknown key — e.g. a typo `pat:` instead of `path:`, or a stray\n * `resourceAccess` on a `workers` entry where it has no meaning today —\n * fails fast at parse time rather than being silently dropped. The\n * minions bucket value schema in `define-saas-config.ts` extends this\n * shape (still strict) to add `resourceAccess` per KD-11.\n */\nexport const AppRefSchema = z.strictObject({\n path: z.string().min(1),\n});\nexport type AppRef = z.infer<typeof AppRefSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"service-definitions.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/service-definitions.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAY,EAAE,WAAW,CAAU,CAAC;AAGzE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C;;;;;;;;GAQG;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AAQ,EAAE;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnE,CAAC,CAAC;AAGH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { WildoCspConfigSchema } from './csp.schemas';\n\n/**\n * `AppFrontendType` lives in `@wildo-ai/saas-models/public-runtime` so the\n * backend's `FrontendServiceDefinitionSchema` (`@wildo-ai/saas-models`) and\n * client-bundle consumers (website discovery, scaffolding, CSP config,\n * companion services) can read the same enum without booting the heavy\n * decorator-bound schema graph. The atom is imported from the\n * `/public-runtime` subpath (NOT the package root barrel) so this file\n * stays free of `initZodDecorators()` side effects — `import { z } from 'zod'`\n * only, plus one decorator-free public-runtime import.\n *\n * The re-export below preserves every existing\n * `import { AppFrontendType } from '@wildo-ai/platform-config-lib'` call site\n * unchanged. Single source of truth (`@wildo-ai/saas-models`) with the\n * original public surface preserved.\n *\n * For the kind-by-kind taxonomy (`SAAS_APP` / `STATIC_WEBSITE` / `TECH_DOC`)\n * and the locked \"no native variants\" design decision, see the file-level\n * JSDoc in `engine/saas-models/src/config/app-frontend-type.shared.schemas.ts`\n * — that is the canonical home; do NOT duplicate the explanation here.\n */\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\n\nexport { AppFrontendType };\n\nexport enum AppLibraryType {\n FULLSTACK = 'fullstack',\n FRONTEND = 'frontend',\n BACKEND = 'backend',\n}\n\n/**\n * How the receiving frontend stores the JWT pair after a cross-frontend\n * handoff exchange (`cross-app-jwt-propagation.md` K-4).\n *\n * - `'ephemeral'` (default) → `EphemeralSessionTokenStorage` (in-memory,\n * dies with the tab). Avoids token poisoning when the source frontend\n * already holds a persistent session, and matches the existing W7.3b\n * `Auth_OneOffSession` guard that refuses non-`Ephemeral` storage.\n * Correct default for `TECH_DOC`, for secondary `SAAS_APP` surfaces\n * (e.g., an admin console reached by handoff from a primary app),\n * and for `STATIC_WEBSITE` (which never stores tokens anyway).\n * - `'persistent'` → `PersistentSessionTokenStorage` (localStorage).\n * Opt-in for the primary `SAAS_APP` surface where the user expects\n * their session to survive a tab close. Each service authors this\n * explicitly; there is no auto-derivation from `frontendType`\n * because a project can have multiple `SAAS_APP` services where\n * only one is \"primary\".\n */\nexport const APP_SESSION_STORAGES = ['persistent', 'ephemeral'] as const;\nexport type AppSessionStorage = (typeof APP_SESSION_STORAGES)[number];\n\n/**\n * The writable mount every containerised app runtime gets, unconditionally.\n *\n * Shared by minions and workers rather than defined twice: it is paired with\n * `readOnlyRootFilesystem: true` in both renderers, and two copies of a path this\n * load-bearing WILL drift. For minions the pairing is acute — the file liveness\n * heartbeat is written here, so separating them restart-loops healthy pods — and\n * while workers probe over HTTP instead, a read-only rootfs with nowhere to write\n * a temp file is its own failure, arriving later and less legibly.\n */\nexport const RUNTIME_MANDATORY_WRITABLE_PATH = '/tmp';\n\n/**\n * Container isolation knobs an app runtime (minion or worker) may author.\n *\n * ## What is deliberately ABSENT\n *\n * The security floor — `runAsNonRoot`, `readOnlyRootFilesystem`,\n * `allowPrivilegeEscalation: false`, `capabilities: drop [ALL]`,\n * `seccompProfile`, `automountServiceAccountToken: false` — is emitted\n * unconditionally by the renderers and cannot be authored down. A config key\n * that turns off root-filesystem protection is a bypass wearing a settings hat;\n * lowering the floor must be a deliberate schema change under review.\n *\n * ## What IS authorable, and why each earns it\n *\n * - `runAsUser` / `runAsGroup` — image-dependent, and demonstrably so: Wonder\n * Todos' Node worker runs as uid 1000 (`USER node`) while its Rust worker uses\n * distroless `nonroot` at uid 65532. No single default is correct, and a wrong\n * uid with `runAsNonRoot: true` means the kubelet refuses to start the\n * container.\n * - `writablePaths` — ADDITIVE only, on top of the always-present\n * {@link RUNTIME_MANDATORY_WRITABLE_PATH}. It can grant writability, never\n * remove it, so it cannot weaken the read-only rootfs.\n * - `pidsLimit` — a fork-bomb ceiling; purely a bound.\n */\nexport const RUNTIME_DEFAULT_PIDS_LIMIT = 512;\n\n/**\n * The field CONSTRAINTS, defined once and shared by the two isolation schemas\n * below so a validation rule cannot hold on one and not the other.\n *\n * `runAsUser`/`runAsGroup` are `.positive()` because 0 is root — the identity\n * the whole floor exists to forbid — and a schema that accepts it would let a\n * config re-enable root while `runAsNonRoot: true` is still emitted, producing a\n * container the kubelet refuses for a reason the config never mentions.\n */\nconst runtimeIsolationFields = {\n runAsUser: z.number().int().positive(),\n runAsGroup: z.number().int().positive(),\n writablePaths: z.array(z.string().min(1).startsWith('/')),\n pidsLimit: z.number().int().positive(),\n};\n\nexport const RuntimeIsolationSchema = z.strictObject({\n runAsUser: runtimeIsolationFields.runAsUser.default(10001),\n runAsGroup: runtimeIsolationFields.runAsGroup.default(10001),\n writablePaths: runtimeIsolationFields.writablePaths.default([]),\n pidsLimit: runtimeIsolationFields.pidsLimit.default(RUNTIME_DEFAULT_PIDS_LIMIT),\n});\n\n/**\n * The AUTHORED form: every knob optional and — critically — carrying NO default.\n *\n * This is not the same thing as `RuntimeIsolationSchema.partial()`, and the\n * difference is a real defect rather than a style point. `.partial()` only makes\n * a field optional; the inner `.default(10001)` still FIRES, so an authored\n * `isolation: { runAsUser: 101 }` parses to a `runAsGroup` of 10001 and the\n * caller can no longer tell \"authored 10001\" from \"authored nothing\". For a\n * service row that difference decides which account the container runs as, and\n * the wrong answer is a pod that never starts.\n *\n * Caught by the pin `honours an authored image-dependent uid…` in\n * `service-definitions.schemas.test.ts`, which was written expecting the kind\n * default and got 10001.\n */\nexport const AuthoredRuntimeIsolationSchema = z.strictObject({\n runAsUser: runtimeIsolationFields.runAsUser.optional(),\n runAsGroup: runtimeIsolationFields.runAsGroup.optional(),\n writablePaths: runtimeIsolationFields.writablePaths.optional(),\n pidsLimit: runtimeIsolationFields.pidsLimit.optional(),\n});\nexport type AuthoredRuntimeIsolation = z.infer<typeof AuthoredRuntimeIsolationSchema>;\nexport type RuntimeIsolation = z.infer<typeof RuntimeIsolationSchema>;\n\n/**\n * Shared `superRefine` body for an authored isolation block.\n *\n * `RUNTIME_MANDATORY_WRITABLE_PATH` is mounted by the renderers, so authoring it\n * again emits two volumeMounts on one mountPath — which Kubernetes rejects at\n * admission, meaning the pod never starts and the error names a duplicate mount\n * rather than the config line that caused it. Caught here, where the message can\n * point at the authored value.\n */\nexport function refineRuntimeIsolation(\n isolation: RuntimeIsolation,\n ctx: z.RefinementCtx,\n path: readonly (string | number)[] = ['isolation'],\n): void {\n const mandatory = isolation.writablePaths.filter(\n (p) => p === RUNTIME_MANDATORY_WRITABLE_PATH || p === `${RUNTIME_MANDATORY_WRITABLE_PATH}/`,\n );\n if (mandatory.length > 0) {\n ctx.addIssue({\n code: 'custom',\n path: [...path, 'writablePaths'],\n message:\n `'${RUNTIME_MANDATORY_WRITABLE_PATH}' is always mounted — remove it from writablePaths, which is `\n + 'for ADDITIONAL scratch mounts only. Authoring it twice emits two volumeMounts on one '\n + 'mountPath and Kubernetes refuses the pod.',\n });\n }\n\n const seen = new Set<string>();\n for (const p of isolation.writablePaths) {\n if (seen.has(p)) {\n ctx.addIssue({\n code: 'custom',\n path: [...path, 'writablePaths'],\n message: `Duplicate writable path '${p}' — same duplicate-mountPath rejection as above.`,\n });\n }\n seen.add(p);\n }\n}\n\n/**\n * The uid/gid an application BACKEND container runs as when nothing is authored.\n *\n * 1001 is not arbitrary and not new: `templates/infra/docker-images/platform/\n * Dockerfile.platform-base` has created `wildo` at 1001 and ended on `USER wildo`\n * since the platform images were written. Reusing it makes the app backend match\n * the convention the framework already ships rather than inventing a third number\n * beside the minion/worker 10001.\n *\n * The paired obligation lives in `Dockerfile.backend-base`: an image whose files\n * are owned by root and whose `USER` is root will be REFUSED by the kubelet under\n * `runAsNonRoot: true`. Schema default and image must move together.\n */\nexport const APP_BACKEND_DEFAULT_RUNTIME_UID = 1001;\n\n/**\n * The uid/gid an application FRONTEND container runs as when nothing is authored.\n *\n * 101 is the `nginx` account in `nginx:1.27-alpine` (verified by running the\n * image, not assumed). Every Wildo frontend is a static bundle served by nginx —\n * the framework mandates that runtime — so defaulting to any other uid would make\n * \"authored nothing\" the broken case, which is exactly the case that must come\n * out working.\n */\nexport const APP_FRONTEND_DEFAULT_RUNTIME_UID = 101;\n\n/**\n * ## Why the frontend container port is NOT changed, measured rather than assumed\n *\n * The obvious reasoning — \"the floor drops ALL capabilities, so a non-root nginx\n * cannot bind :80 without `CAP_NET_BIND_SERVICE`\" — is FALSE in a container, and\n * an earlier revision of this file asserted it in JSDoc before anyone ran it.\n *\n * Docker and containerd both set `net.ipv4.ip_unprivileged_port_start=0` inside\n * the container's network namespace, so ports below 1024 are not privileged there\n * at all. Measured against `nginx:1.27-alpine`: `cat\n * /proc/sys/net/ipv4/ip_unprivileged_port_start` prints `0`, and nginx running as\n * uid 101 with a read-only rootfs and no capabilities serves HTTP 200 on :80.\n *\n * So the frontends keep `listen 80` and the Service keeps `targetPort: 80`. No\n * nginx config, Dockerfile `EXPOSE`, Service or Traefik router changes are part\n * of this floor. What nginx DOES need is\n * {@link APP_FRONTEND_MANDATORY_WRITABLE_PATHS} — see there.\n */\n\n/**\n * Writable mounts an nginx frontend needs BEYOND\n * {@link RUNTIME_MANDATORY_WRITABLE_PATH}, emitted unconditionally rather than\n * authored.\n *\n * They are not additive author choices — they are what the runtime the framework\n * MANDATES cannot start without, measured against `nginx:1.27-alpine`:\n *\n * - `/var/cache/nginx` — the parent of `client_temp`/`proxy_temp`/… . Present in\n * the image but owned by `root:root` 0755, so a non-root master cannot create\n * the temp directories inside it.\n * - `/run` — where the stock `nginx.conf` writes `nginx.pid` (`/var/run` is a\n * symlink to it). Root-owned, so the pid write fails and nginx exits.\n *\n * Mounting them as writable volumes is preferred over `chown`-ing in every\n * application's Dockerfile: it keeps the requirement in the framework's runtime\n * spec, where it is emitted once and cannot be forgotten per app.\n */\nexport const APP_FRONTEND_MANDATORY_WRITABLE_PATHS: readonly string[] = ['/var/cache/nginx', '/run'];\n\n/**\n * Resolve a service row's effective container isolation.\n *\n * THE reason this exists as a function rather than a schema default: the correct\n * default depends on the container KIND, and a Zod field default cannot see its\n * sibling `frontendType`. Two renderers consume this (k8s manifests and the\n * compose app lane) and they must not each apply their own fallback — that is how\n * a k8s pod and a compose container end up running as different users from one\n * config row.\n *\n * Frontend rows additionally receive {@link APP_FRONTEND_MANDATORY_WRITABLE_PATHS}\n * prepended, because nginx cannot start without them. They are prepended rather\n * than appended so an author reading the rendered manifest sees the framework's\n * mounts first, and deduplicated against the authored list so re-authoring one is\n * tolerated here (unlike `/tmp`, these are nginx implementation detail rather\n * than a documented contract, so a duplicate is a mistake worth absorbing instead\n * of a config error worth failing on).\n */\nexport function resolveAppServiceIsolation(\n service: Pick<AppServiceDefinition, 'frontendType'> & { isolation?: Partial<RuntimeIsolation> },\n): RuntimeIsolation {\n const isFrontend = service.frontendType !== undefined;\n const defaultUid = isFrontend ? APP_FRONTEND_DEFAULT_RUNTIME_UID : APP_BACKEND_DEFAULT_RUNTIME_UID;\n const authoredPaths = service.isolation?.writablePaths ?? [];\n const mandatory = isFrontend ? APP_FRONTEND_MANDATORY_WRITABLE_PATHS : [];\n\n return {\n runAsUser: service.isolation?.runAsUser ?? defaultUid,\n runAsGroup: service.isolation?.runAsGroup ?? defaultUid,\n writablePaths: [...mandatory, ...authoredPaths.filter((p) => !mandatory.includes(p))],\n pidsLimit: service.isolation?.pidsLimit ?? RUNTIME_DEFAULT_PIDS_LIMIT,\n };\n}\n\n/**\n * One service inside `wildo.saas.config.ts` `services` map.\n *\n * `sessionStorage` (default `'ephemeral'`) is the per-service explicit\n * opt-in to localStorage; the default matches the non-primary-surface\n * common case. See `APP_SESSION_STORAGES` JSDoc for the rationale.\n *\n * `csp?` lives here only for `frontendType: SAAS_APP`. Unlike\n * `STATIC_WEBSITE` / `TECH_DOC`, the main app currently has no\n * engine-owned per-service config file (`wildo.website.config.ts` /\n * `wildo.tech-doc.config.ts`) — the service row itself is therefore the\n * honest app-static authoring seam for SPA-specific posture such as CSP.\n * Non-app services MUST reject authored `csp` here to preserve the\n * semantic split between the generic service declaration and the\n * website/docs engine-owned config files.\n *\n * No host-binding or public-URL authoring on this schema. The public\n * hostname per service is authored per-environment in\n * `infra.serviceHosts` — that seam is in `define-infra-env-config.ts`\n * and is intentionally decoupled from `frontendType` and from the\n * service key so the app developer can map any service to any host\n * (e.g. `services.docs` published at `dev.example.com`).\n */\nexport const AppServiceDefinitionSchema = z.strictObject({\n path: z.string().min(1),\n serviceName: z.string().min(1),\n defaultPort: z.number().int().positive().optional(),\n frontendType: z.enum(AppFrontendType).optional(),\n sessionStorage: z.enum(APP_SESSION_STORAGES).default('ephemeral'),\n csp: WildoCspConfigSchema.optional(),\n /**\n * Container isolation — the same contract minions and workers carry, applied to\n * the two container kinds that had none: the app backend and each frontend.\n *\n * `.optional()` here, unlike the minion/worker `.prefault({})`, because the\n * correct DEFAULT depends on the kind and the kind is not known until the row\n * is read: a backend runs Node as {@link APP_BACKEND_DEFAULT_RUNTIME_UID}, a\n * frontend runs nginx as {@link APP_FRONTEND_DEFAULT_RUNTIME_UID}. Emitting one\n * number for both would hand half the services a uid their image does not\n * define. Callers resolve it through {@link resolveAppServiceIsolation}, which\n * is where \"authored nothing\" becomes a hardened value — never at a renderer,\n * so the two renderers cannot disagree.\n *\n * The floor is absent for the same reason it is absent from the minion and\n * worker schemas: it is emitted unconditionally and must not be authorable\n * down. See {@link RuntimeIsolationSchema}.\n */\n isolation: AuthoredRuntimeIsolationSchema.optional(),\n}).superRefine((service, ctx) => {\n if (service.isolation) {\n refineRuntimeIsolation(resolveAppServiceIsolation(service), ctx);\n }\n if (service.csp !== undefined && service.frontendType !== AppFrontendType.SAAS_APP) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp'],\n message:\n 'services.<key>.csp is only supported for `frontendType: SAAS_APP`. '\n + 'STATIC_WEBSITE and TECH_DOC services must author CSP in their per-service '\n + '`wildo.website.config.ts` / `wildo.tech-doc.config.ts` files, and '\n + 'non-frontend services cannot ship a document CSP.',\n });\n }\n});\nexport type AppServiceDefinition = z.infer<typeof AppServiceDefinitionSchema>;\nexport type AppServiceDefinitionInput = z.input<typeof AppServiceDefinitionSchema>;\n\nexport const AppLibraryDefinitionSchema = z.object({\n path: z.string().min(1),\n type: z.enum(AppLibraryType),\n}).strict();\nexport type AppLibraryDefinition = z.infer<typeof AppLibraryDefinitionSchema>;\n\nexport const WorkerRuntimeSchema = z.object({\n type: z.string().min(1),\n language: z.string().min(1),\n});\nexport type WorkerRuntime = z.infer<typeof WorkerRuntimeSchema>;\n\nexport const ResourceLimitsSchema = z.object({\n cpu: z.string().min(1).optional(),\n memory: z.string().min(1).optional(),\n});\nexport type ResourceLimits = z.infer<typeof ResourceLimitsSchema>;\n\nexport const DataAccessSchema = z.object({\n database: z.enum(['read-only', 'read-write', 'none']).optional(),\n cache: z.boolean().optional(),\n queue: z.enum(['consumer', 'producer', 'both', 'none']).optional(),\n});\nexport type DataAccess = z.infer<typeof DataAccessSchema>;\n\n/**\n * Minimal \"I live at this path\" reference for a per-folder app sub-config\n * (`wildo.minion.config.ts`, `wildo.worker.config.ts`, `wildo.specifications.config.ts`).\n *\n * Tightened to `z.strictObject` (M-3 in\n * `.cursor/plans/minions-and-workers-implementation.md`) so authoring an\n * unknown key — e.g. a typo `pat:` instead of `path:`, or a stray\n * `resourceAccess` on a `workers` entry where it has no meaning today —\n * fails fast at parse time rather than being silently dropped. The\n * minions bucket value schema in `define-saas-config.ts` extends this\n * shape (still strict) to add `resourceAccess` per KD-11.\n */\nexport const AppRefSchema = z.strictObject({\n path: z.string().min(1),\n});\nexport type AppRef = z.infer<typeof AppRefSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systems-of-record-env.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"systems-of-record-env.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/systems-of-record-env.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B;IAErC;;;;OAIG;;;IAIH;;;OAGG;;oBAUL,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,yGAAyG;AACzG,eAAO,MAAM,mCAAmC;IAzB5C;;;;OAIG;;;IAIH;;;OAGG;;qBAcqG,CAAC;AAC7G,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systems-of-record-env.schemas.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"systems-of-record-env.schemas.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/systems-of-record-env.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC;IAClD,CAAC,CAAC,YAAY,CAAC;QACb;;;;WAIG;QACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;KAC1B,CAAC;IACF,CAAC,CAAC,YAAY,CAAC;QACb;;;WAGG;QACH,OAAO,EAAE,CAAC;aACP,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kCAAkC,EAAE,mDAAmD,CAAC,EACzG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAClB;aACA,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACpD,KAAK,EAAE,qGAAqG;SAC7G,CAAC;KACL,CAAC;CACH,CAAC,CAAC;AAGH,yGAAyG;AACzG,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["/**\n * WHERE each declared system of record lives, per ENVIRONMENT (#1055 §2).\n *\n * The saas config says WHAT the application reads (`systemsOfRecord.<name>`: a vendor, a dialect);\n * this says WHERE that instance is in THIS environment, and `secrets.json` says with what. The same\n * split `applicationDatabase` already makes between selection and substrate, for the same reason: an\n * address is environment-specific and a declaration is not.\n *\n * ## Two authored shapes, and the second one is the point\n *\n * ```ts\n * systemsOfRecord: {\n * odoo: { address: { baseUrl: 'https://acme.odoo.com', database: 'acme', login: 'bot@acme.com' } },\n * }\n * ```\n *\n * ```ts\n * systemsOfRecord: {\n * odoo: { enabled: false }, // this environment has no access to the ERP\n * }\n * ```\n *\n * A developer laptop and a staging with no ERP are the ordinary case, not an edge (#1055 E3), and\n * they need a way to SAY so. Without one, \"no access here\" and \"somebody forgot to author the\n * address\" are the same observation — and they need opposite behaviours: the first boots and refuses\n * reads with a clear code, the second refuses at `wildo config sync` and again at boot. So silence is\n * never a declaration: an instance the saas config declares and this file omits entirely is refused.\n *\n * ## What this file deliberately does NOT know\n *\n * Which slots a vendor NEEDS. That is the facet's, and the facet is not in scope here — the saas\n * config and the infra env config parse independently. Completeness is therefore checked at the\n * SEAMS where both are visible: `wildo config sync` and the backend startup validator. What is\n * checked here is only the shape and the slot-slug charset, because a slug outside it could not\n * derive a parseable variable name.\n *\n * ## Addresses are not secrets\n *\n * A base URL is registration-scoped, and a database name and a login identify WHICH deployment and\n * WHICH user rather than proving anything. They belong in the authored infra file, where they are\n * diffable and reviewable. The credential lives in `secrets.json`, keyed by the same derived name.\n */\nimport { z } from 'zod';\nimport { SYSTEM_OF_RECORD_SLOT_SLUG_PATTERN } from '@wildo-ai/saas-models';\n\n/**\n * One instance's address in one environment.\n *\n * A union rather than one object with two optional halves, so the two states cannot be authored at\n * once and neither can be half-written: an entry is either an address or a declaration of absence.\n */\nexport const WildoSystemOfRecordEnvSchema = z.union([\n z.strictObject({\n /**\n * This environment has NO access to the instance. Reads on a bound resource refuse with a stable\n * code, a scheduled pipeline is not dispatched, and the backend still boots — an application\n * whose ERP is simply not present in staging must still run.\n */\n enabled: z.literal(false),\n }),\n z.strictObject({\n /**\n * The vendor's non-secret address slots, keyed by the facet's slug (Odoo: `baseUrl`, `database`,\n * `login`). Whether the set is COMPLETE is the seam's question, not this schema's.\n */\n address: z\n .record(\n z.string().regex(SYSTEM_OF_RECORD_SLOT_SLUG_PATTERN, 'A slot slug is lowerCamelCase with no separators.'),\n z.string().min(1),\n )\n .refine((address) => Object.keys(address).length > 0, {\n error: 'An address with no slots says nothing. Author the vendor\\'s slots, or declare `{ enabled: false }`.',\n }),\n }),\n]);\nexport type WildoSystemOfRecordEnv = z.infer<typeof WildoSystemOfRecordEnvSchema>;\n\n/** Every instance's address in this environment, keyed by the instance name the saas config declares. */\nexport const WildoSystemsOfRecordEnvConfigSchema = z.record(z.string().min(1), WildoSystemOfRecordEnvSchema);\nexport type WildoSystemsOfRecordEnvConfig = z.infer<typeof WildoSystemsOfRecordEnvConfigSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-asset-import-noop.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"static-asset-import-noop.d.ts","sourceRoot":"","sources":["../../../../src/project-config/static-asset-import-noop.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,eAAO,MAAM,kCAAkC,wFAAwF,CAAC;AAIxI;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAqBpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-asset-import-noop.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"static-asset-import-noop.js","sourceRoot":"","sources":["../../../../src/project-config/static-asset-import-noop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,gGAAgG;AAChG,MAAM,CAAC,MAAM,kCAAkC,GAAG,qFAAqF,CAAC;AAExI,IAAI,+BAA+B,GAAG,KAAK,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,+BAA+B,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAG;wBACG,kCAAkC;;;;;;;;;;;;;GAavD,CAAC;IACF,QAAQ,CAAC,wBAAwB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACnE,+BAA+B,GAAG,IAAI,CAAC;AACzC,CAAC","sourcesContent":["import { register } from 'node:module';\n\n/** The static-asset extensions a TypeScript module graph may import and Node cannot execute. */\nexport const STATIC_ASSET_IMPORT_PATTERN_SOURCE = '\\\\.(css|scss|less|sass|svg|png|jpe?g|gif|webp|ico|avif|woff2?|eot|ttf|otf)(\\\\?.*)?$';\n\nlet staticAssetImportNoopRegistered = false;\n\n/**\n * Make static-asset imports (`.css`, images, fonts) resolve to empty modules for the rest of the\n * process, so a Node-side loader can evaluate an application-authored TypeScript graph that\n * reaches browser code.\n *\n * Why this is needed at all: an application's specifications and website sources import enums\n * from `@wildo-ai/saas-specifications`, whose root transitively reaches frontend component\n * modules that import their stylesheets. Node's ESM loader cannot execute a `.css`, so without\n * this hook an otherwise valid module fails to load solely because a library imports a stylesheet.\n * Static assets carry no meaning for a Node-side reader, so they load as `export default \"\"`.\n *\n * Process-wide, idempotent, and inert for any graph that imports no static asset. It never touches\n * JavaScript or TypeScript resolution.\n *\n * This is the one copy for in-process callers. Four hand-copied versions existed until 2026-09-25\n * — two in the dev companion and two in the CLI — each with its own regex; the next asset type\n * added to one would have loaded in one tool and failed in another. One copy remains by necessity:\n * the dev companion's introspection subprocess registers a hooks MODULE by path\n * (`asset-noop-hooks.ts`), and loader hooks run on their own thread before anything else loads, so\n * that module must stay dependency-free. `static-asset-pattern-parity.test.ts` in the companion\n * holds its pattern equal to this one.\n */\nexport function registerStaticAssetImportNoop(): void {\n if (staticAssetImportNoopRegistered) {\n return;\n }\n const hookSource = `\n const ASSET_RE = /${STATIC_ASSET_IMPORT_PATTERN_SOURCE}/;\n export function resolve(specifier, context, nextResolve) {\n if (ASSET_RE.test(specifier)) {\n return { shortCircuit: true, url: new URL(specifier, context.parentURL ?? 'file:///').href };\n }\n return nextResolve(specifier, context);\n }\n export function load(url, context, nextLoad) {\n if (ASSET_RE.test(url)) {\n return { shortCircuit: true, format: 'module', source: 'export default \"\";\\\\n' };\n }\n return nextLoad(url, context);\n }\n `;\n register(`data:text/javascript,${encodeURIComponent(hookSource)}`);\n staticAssetImportNoopRegistered = true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-domain.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"artifact-domain.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/artifact-domain.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,mCAAmC,mCAAoC,CAAC;AAE9E,eAAO,MAAM,0BAA0B;IACrC,yDAAyD;;IAEzD,wCAAwC;;CAEhC,CAAC;AACX,eAAO,MAAM,gCAAgC;;;EAA8C,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,QAAA,MAAM,6BAA6B,uCAAwC,CAAC;AAE5E,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AACX,eAAO,MAAM,yBAAyB;;;;EAAwC,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;IAC3C,qEAAqE;;;;;IAErE;;;OAGG;;kBAEH,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-domain.schemas.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"artifact-domain.schemas.js","sourceRoot":"","sources":["../../../../src/registry/artifact-domain.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mCAAmC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAU,CAAC;AAE9E,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,yDAAyD;IACzD,MAAM,EAAE,QAAQ;IAChB,wCAAwC;IACxC,UAAU,EAAE,YAAY;CAChB,CAAC;AACX,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;AAI5F,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAE5E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACN,CAAC;AACX,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAG/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7D,qEAAqE;IACrE,iBAAiB,EAAE,gCAAgC;IACnD;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE;CACtB,CAAC,CAAC","sourcesContent":["/**\n * Artifact-domain access schemas — public vs restricted retrieval.\n *\n * Phase 1 surfaces the access vocabulary so Phase 3 (registry\n * server) and Phase 5 (CLI install) speak the same dialect. The\n * library does NOT implement authorization here — that's\n * gateway-side middleware (KD-7 / Security model). These schemas\n * pin the contract.\n */\n\nimport { z } from 'zod';\n\nconst REGISTRY_ARTIFACT_VISIBILITY_VALUES = ['PUBLIC', 'RESTRICTED'] as const;\n\nexport const RegistryArtifactVisibility = {\n /** Anonymous read allowed; integrity always verified. */\n PUBLIC: 'PUBLIC',\n /** Requires a domain `read` API key. */\n RESTRICTED: 'RESTRICTED',\n} as const;\nexport const RegistryArtifactVisibilitySchema = z.enum(REGISTRY_ARTIFACT_VISIBILITY_VALUES);\nexport type RegistryArtifactVisibility =\n (typeof REGISTRY_ARTIFACT_VISIBILITY_VALUES)[number];\n\nconst REGISTRY_API_KEY_SCOPE_VALUES = ['read', 'publish', 'admin'] as const;\n\nexport const RegistryApiKeyScope = {\n READ: 'read',\n PUBLISH: 'publish',\n ADMIN: 'admin',\n} as const;\nexport const RegistryApiKeyScopeSchema = z.enum(REGISTRY_API_KEY_SCOPE_VALUES);\nexport type RegistryApiKeyScope = (typeof REGISTRY_API_KEY_SCOPE_VALUES)[number];\n\n/**\n * Per-domain access policy. Held alongside `RegistryDomain` rows on\n * the server; the CLI receives a redacted projection via\n * `wildo registry info`.\n */\nexport const RegistryDomainAccessPolicySchema = z.strictObject({\n /** Default visibility for newly-published modules in this domain. */\n defaultVisibility: RegistryArtifactVisibilitySchema,\n /**\n * Email of the first-admin / domain owner. Recovery anchor per\n * KD-11 / Security model.\n */\n ownerEmail: z.email(),\n});\nexport type RegistryDomainAccessPolicy = z.infer<typeof RegistryDomainAccessPolicySchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digest.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"digest.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/digest.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAE0C,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"digest.schemas.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"digest.schemas.js","sourceRoot":"","sources":["../../../../src/registry/digest.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,KAAK,CAAC,uBAAuB,EAAE,sCAAsC,CAAC,CAAC","sourcesContent":["/**\n * Cryptographic-digest field schemas — single source of truth for\n * artifact integrity references across the module-registry surface.\n *\n * Both the durable lockfile entry (`RegistryModulesLockEntry.\n * artifactDigest`) and the registry-server published-version row\n * (`ModuleVersionRecord.integrity`) carry the same artifact's\n * digest. They MUST agree on format — drift between the two means\n * Phase 5 install verification fails non-deterministically. Hoisted\n * here so any addition (e.g. sha512) lands in one place.\n */\n\nimport { z } from 'zod';\n\n/**\n * `sha256:<64-hex>` content digest. The hex must be lowercase\n * (npm + most registries normalize to lowercase; uppercase makes\n * direct string comparison brittle).\n */\nexport const Sha256DigestSchema = z\n .string()\n .regex(/^sha256:[0-9a-f]{64}$/, 'expected `sha256:<64-hex-lowercase>`');\nexport type Sha256Digest = z.infer<typeof Sha256DigestSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC","sourcesContent":["/**\n * Module-registry subpackage barrel\n * (per `.claude/plans/module-registry-analysis.md`).\n *\n * Surface:\n * - `RegistryModulesLockSectionSchema` — `sections.modules` payload.\n * - `DEFAULT_REGISTRY_SECTION_SCHEMAS` — CLI default lockfile-section map.\n * - `DEFAULT_LOCAL_REGISTRY_URL` / `DEFAULT_PUBLIC_REGISTRY_URL` /\n * `DEFAULT_LOCAL_REGISTRY_PORT` / `DEFAULT_REGISTRY_ID`.\n * - `ModuleManifestSchema` — `wildo.module.json` contract\n * (engine compat, boundaries, dependsOn buckets per KD-12 + KD-13).\n * - `ModuleVersionRecordSchema` — registry-server published-version row.\n * - `Sha256DigestSchema` — single-source digest field used by\n * both lockfile entries and registry-server records.\n * - `RegistryConfigSchema` — `wildo.saas.config.ts > moduleRegistries`.\n * - `RegistryArtifactVisibility` / `RegistryApiKeyScope` /\n * `RegistryDomainAccessPolicy` — access-control vocabulary.\n * - `RegistryError` family — typed-error vocabulary with\n * stable `code` strings.\n *\n * Phase 2+ adds artifact-staging + companion-mutation contracts.\n */\n\nexport * from './digest.schemas';\nexport * from './lockfile-modules-section.schemas';\nexport * from './module-manifest.schemas';\nexport * from './module-search.schemas';\nexport * from './module-artifact.schemas';\nexport * from './artifact-domain.schemas';\nexport * from './registry-config.schemas';\nexport * from './registry-defaults.constants';\nexport * from './registry-errors';\nexport * from './registry-section-schemas.constants';\nexport * from './registry-keys.schemas';\nexport * from './local-checkout-source';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-checkout-source.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"local-checkout-source.d.ts","sourceRoot":"","sources":["../../../../src/registry/local-checkout-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQxH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-checkout-source.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"local-checkout-source.js","sourceRoot":"","sources":["../../../../src/registry/local-checkout-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAqC;IAC3E,SAAS,EAAE,oBAAoB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,aAAqB,EAAE,MAAc,EAAE,QAAgB;IAClG,IAAI,MAAM,KAAK,qBAAqB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IAChF,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC9D,MAAM,QAAQ,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAChD,OAAO,SAAS,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Local-checkout source for registry modules (#2015, epic #2012).\n *\n * Paul, 2026-09-29: in framework development the registry is fetched LOCALLY, from the checkout, with no\n * server and no publish step. Wildo's own providers are authored in the monorepo under\n * `providers-registry/<ref>/`; a dogfood application inside the checkout installs them from there, and an\n * application anywhere else installs them from the public registry (#2024).\n *\n * This file owns only the LAYOUT: which domain the checkout answers for, and where one of its modules\n * lives. Reading and staging a module is the CLI's job (`local-checkout-module-source.service.ts`).\n */\n\nimport * as path from 'node:path';\nimport { isModuleId } from './module-manifest.schemas';\n\n/**\n * The registry domain Wildo publishes its own modules under, on `registry.wildo.ai`. Inside a framework\n * checkout the same domain is answered by the checkout itself, so one install spec\n * (`wildo/providers/asana`) means the same module in both places.\n */\nexport const WILDO_REGISTRY_DOMAIN = 'wildo';\n\n/**\n * Where each module-id SCOPE of the `wildo` domain is authored in the framework checkout.\n *\n * A module `<scope>/<name>` lives at `<frameworkRoot>/<root>/<name>/`, holding its `wildo.module.json` and\n * the content of its single boundary directory: for a provider (`providers/<ref>`) that is one folder per\n * facet (`backend/`, `frontend/`). A scope absent from this table has no local source.\n */\nexport const LOCAL_CHECKOUT_MODULE_ROOTS: Readonly<Record<string, string>> = {\n providers: 'providers-registry',\n};\n\n/**\n * The checkout directory of `<domain>/<moduleId>`, or `undefined` when the checkout does not author it\n * (another domain, or a scope with no local root). Never resolves outside its scope root.\n */\nexport function localCheckoutModuleDirectory(frameworkRoot: string, domain: string, moduleId: string): string | undefined {\n if (domain !== WILDO_REGISTRY_DOMAIN || !isModuleId(moduleId)) return undefined;\n const [scope, name] = moduleId.split('/') as [string, string];\n const rootName = LOCAL_CHECKOUT_MODULE_ROOTS[scope];\n if (rootName === undefined) return undefined;\n const scopeRoot = path.resolve(frameworkRoot, rootName);\n const directory = path.resolve(scopeRoot, name);\n return directory.startsWith(scopeRoot + path.sep) ? directory : undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile-modules-section.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"lockfile-modules-section.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/lockfile-modules-section.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC;;;;EAAyC,CAAC;AACzF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B;;;;OAIG;IACH,QAAQ,aAAa;IACrB;;;;;OAKG;IACH,cAAc,mBAAmB;CAClC;AAKD;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B;IACzC,oEAAoE;;IAEpE,uFAAuF;;IAEvF,sFAAsF;;IAEtF,uFAAuF;;IAEvF,uFAAuF;;IAEvF,mGAAmG;;IAEnG,uDAAuD;;IAEvD,gDAAgD;;IAEhD,oEAAoE;;IAEpE;;;;;OAKG;;IAEH,sDAAsD;;IAEtD;;;;;;;;;OASG;;IAIH;;;;;;;;;;;;;;;OAeG;;IAEH,oDAAoD;;;;;;IAEpD;;;;OAIG;;;;;;;;;;;;;;;;;;;kBAgBH,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE3F,0CAA0C;AAC1C,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,gDAAgD;AAChD,MAAM,WAAW,6BAA6B;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,wBAAwB,GAAG,wBAAwB,CAQ9F;AAED,sGAAsG;AACtG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,wBAAwB,GAAG,6BAA6B,CAKxG;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC;;QAnI3C,oEAAoE;;QAEpE,uFAAuF;;QAEvF,sFAAsF;;QAEtF,uFAAuF;;QAEvF,uFAAuF;;QAEvF,mGAAmG;;QAEnG,uDAAuD;;QAEvD,gDAAgD;;QAEhD,oEAAoE;;QAEpE;;;;;WAKG;;QAEH,sDAAsD;;QAEtD;;;;;;;;;WASG;;QAIH;;;;;;;;;;;;;;;WAeG;;QAEH,oDAAoD;;;;;;QAEpD;;;;WAIG;;;;;;;;;;;;;;;;;;;;kBA2EJ,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile-modules-section.schemas.js","sourceRoot":"","sources":["../../../src/registry/lockfile-modules-section.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE9I;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC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OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;AAChH,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,yBAAyB,CAAC,KAA+B;IACvE,IAAI,KAAK,CAAC,YAAY,KAAK,kBAAkB,CAAC,cAAc,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACxI,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,oCAAoC,KAAK,CAAC,YAAY,qCAAqC,CAAC,CAAC;IACjI,CAAC;IACD,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;AACtF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7D,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACnF,CAAC,CAAC,MAAM;AACP,kGAAkG;AAClG,iFAAiF;AACjF,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,CAAC,EAC9F,EAAE,KAAK,EAAE,uEAAuE,EAAE,CACnF,CAAC","sourcesContent":["/**\n * `sections.modules` lockfile section — installed-code state for the\n * Wildo module registry.\n *\n * Owns the durable record of which modules a SaaS app has installed,\n * which exact version + artifact digest is on disk, and which files\n * the registry copied in. Sibling lockfile sections (`providers`,\n * `i18n`) live next to this one under the canonical\n * `wildo-saas.lock.json` envelope and are NEVER touched by code that\n * mutates `sections.modules`.\n *\n * The shape mirrors `module-registry-analysis.md` KD-4 / \"Lockfile\n * Shape\". Fields are intentionally minimal at Phase 0.5 — additional\n * fields must be justified by install/update behavior rather than\n * added preemptively.\n */\n\nimport { z } from 'zod';\nimport { Sha256DigestSchema } from './digest.schemas';\nimport { isModuleOwnedFilePath, ModuleIdSchema, ModuleManifestRegistrationSchema, RegistryDomainSlugSchema } from './module-manifest.schemas';\n\n/**\n * Source label recorded with each lockfile entry. Distinguishes\n * registry-installed code from `adopt`-promoted local code; lets the\n * `update`/`remove` flows decide whether overwriting is a safe\n * round-trip or a destructive operation.\n */\nexport const RegistryModulesInstallSourceSchema = z.enum(['install', 'update', 'adopt']);\nexport type RegistryModulesInstallSource = z.infer<typeof RegistryModulesInstallSourceSchema>;\n\n/**\n * Where an installed module's bytes came from (#2015). Distinct from `source` (install | update | adopt),\n * which records the ACTION that wrote the entry; this records the ORIGIN, and each origin carries\n * different provenance.\n */\nexport enum ModuleDistribution {\n /**\n * Downloaded from a registry server. Provenance: `registryId`, `registryUrl` and `artifactDigest` (the\n * pinned artifact, whose bytes never change for a version). The kind of every entry written before\n * #2015, which is why an entry that omits `distribution` reads as REGISTRY.\n */\n REGISTRY = 'registry',\n /**\n * Staged from the framework checkout's own source (`providers-registry/<ref>/`, see\n * `local-checkout-source.ts`) in framework development. There is no artifact and no digest: the\n * provenance is the checkout commit, plus whether the module's source had uncommitted changes when it\n * was staged, because then the commit alone does not describe the bytes.\n */\n LOCAL_CHECKOUT = 'local-checkout',\n}\n\n/** A full git commit id, as `git rev-parse HEAD` prints it. */\nconst GIT_COMMIT_REGEX = /^[0-9a-f]{40}$/;\n\n/**\n * One installed-module record. Keyed by module id in\n * `RegistryModulesLockSectionSchema.installed`.\n *\n * The provenance fields depend on {@link ModuleDistribution}: a REGISTRY entry carries `registryId`,\n * `registryUrl` and `artifactDigest`; a LOCAL_CHECKOUT entry carries `checkoutCommit` and\n * `checkoutDirty` and none of the registry fields. Read them through {@link registryProvenanceOf} /\n * {@link localCheckoutProvenanceOf}, which refuse the other kind rather than returning `undefined`.\n */\nexport const RegistryModulesLockEntrySchema = z.strictObject({\n /** Module id, mirrors the manifest's `id` (e.g. `acme/billing`). */\n moduleId: ModuleIdSchema,\n /** Where the module came from. Absent reads as REGISTRY (every entry before #2015). */\n distribution: z.enum(ModuleDistribution).default(ModuleDistribution.REGISTRY),\n /** REGISTRY only. Registry id from `wildo.saas.config.ts > moduleRegistries[].id`. */\n registryId: z.string().min(1).optional(),\n /** REGISTRY only. Resolved registry URL at install time. Stored for audit + repair. */\n registryUrl: z.string().min(1).optional(),\n /** LOCAL_CHECKOUT only. The framework checkout's commit when the module was staged. */\n checkoutCommit: z.string().regex(GIT_COMMIT_REGEX).optional(),\n /** LOCAL_CHECKOUT only. Whether the module's source had uncommitted changes when it was staged. */\n checkoutDirty: z.boolean().optional(),\n /** Domain segment under the registry (e.g. `acme`). */\n domain: RegistryDomainSlugSchema,\n /** Concrete resolved semver — never a range. */\n version: z.string().min(1),\n /** Original CLI input (e.g. `^1.2.0`), kept for diff visibility. */\n requestedRange: z.string().min(1).optional(),\n /**\n * REGISTRY only. Artifact integrity digest, format `sha256:<64-hex-lowercase>`.\n * Must match `ModuleVersionRecord.integrity` for the same artifact\n * — both fields share `Sha256DigestSchema` so a Phase 5 install\n * compares like-for-like (M-2.5).\n */\n artifactDigest: Sha256DigestSchema.optional(),\n /** ISO datetime of install for audit-log purposes. */\n installedAt: z.iso.datetime({ offset: true }),\n /**\n * File paths copied into app source, relative to saas-root (POSIX separators).\n *\n * Each entry must be a file a module can own ({@link isModuleOwnedFilePath}): below a layer root,\n * with no dot-segment or `node_modules`. `wildo registry remove` and `update` DELETE these paths.\n * The lockfile is committed, merged and hand-edited, so an unconstrained string here — `\".\"`,\n * `\"..\"`, `\"/\"`, `\"wildo.saas.config.ts\"` — was a delete of the application's own files waiting for\n * one bad merge. Refusing at parse time means a poisoned entry stops every registry command before\n * any file is touched.\n */\n files: z.array(z.string().min(1).refine(isModuleOwnedFilePath, {\n error: 'module file entries must be application-relative POSIX paths below a module layer root, with no segment that starts with `.` or is `node_modules`',\n })).default([]),\n /**\n * The SHA-256 of each file as the installer last WROTE it (#2016), keyed by the paths in `files`.\n *\n * A copied module is the application's to edit (the shadcn model), so `update`, `remove` and `repair`\n * must know which files the user changed before they overwrite or delete one: equal to this hash\n * means untouched and safe to replace; different means edited and kept, with a warning.\n *\n * Deliberately a separate map beside `files` rather than a reshape of it. `files` is OWNERSHIP, a\n * security rule (`remove` deletes those paths), and stays strictly validated; this is a fingerprint,\n * and is read TOLERANTLY: a malformed map reads as absent, and a path with no valid hash is treated as\n * edited. A bad fingerprint can only make a command more careful, never unable to run.\n *\n * Not a ledger in the one-source-of-truth sense: it lives in the committed lockfile, so it branches\n * and merges with the files it describes, and it never gates boot, `config sync` or a build.\n * Precedent: Debian and RPM conffile handling.\n */\n installedFileHashes: z.record(z.string(), z.string()).optional().catch(undefined),\n /** Provenance flag — install vs update vs adopt. */\n source: RegistryModulesInstallSourceSchema.optional(),\n /**\n * The registration the install APPLIED to the host's registries, so `remove` reverses exactly those\n * edits and `update` can tell whether it changed. Absent = nothing was registered (the module has no\n * registration, or it was installed before registration existed).\n */\n registration: ModuleManifestRegistrationSchema.optional(),\n}).superRefine((entry, context) => {\n const registryFields = (['registryId', 'registryUrl', 'artifactDigest'] as const).filter((field) => entry[field] !== undefined);\n const checkoutFields = (['checkoutCommit', 'checkoutDirty'] as const).filter((field) => entry[field] !== undefined);\n if (entry.distribution === ModuleDistribution.REGISTRY) {\n for (const field of ['registryId', 'registryUrl', 'artifactDigest'] as const) {\n if (entry[field] === undefined) context.addIssue({ code: 'custom', path: [field], message: `a registry-distributed entry records its ${field}` });\n }\n for (const field of checkoutFields) context.addIssue({ code: 'custom', path: [field], message: `${field} belongs to a local-checkout entry` });\n return;\n }\n for (const field of ['checkoutCommit', 'checkoutDirty'] as const) {\n if (entry[field] === undefined) context.addIssue({ code: 'custom', path: [field], message: `a local-checkout entry records its ${field}` });\n }\n for (const field of registryFields) context.addIssue({ code: 'custom', path: [field], message: `${field} belongs to a registry-distributed entry` });\n});\nexport type RegistryModulesLockEntry = z.infer<typeof RegistryModulesLockEntrySchema>;\n/**\n * What a writer supplies: the entry BEFORE parsing, where defaulted fields (`distribution`, `files`) may\n * be omitted. Writers go through `RegistryLockfileService.upsertEntry`, which parses it, so a default is\n * applied in one place rather than restated at every call site.\n */\nexport type RegistryModulesLockEntryInput = z.input<typeof RegistryModulesLockEntrySchema>;\n\n/** The provenance of a REGISTRY entry. */\nexport interface RegistryModuleProvenance {\n registryId: string;\n registryUrl: string;\n artifactDigest: string;\n}\n\n/** The provenance of a LOCAL_CHECKOUT entry. */\nexport interface LocalCheckoutModuleProvenance {\n checkoutCommit: string;\n checkoutDirty: boolean;\n}\n\n/**\n * The registry an entry was downloaded from, or a refusal naming the entry's real origin. The one way\n * a command reads the registry fields: a local-checkout entry has none, and silently treating it as a\n * registry install would send `update` or `repair` to a server that never served it.\n */\nexport function registryProvenanceOf(entry: RegistryModulesLockEntry): RegistryModuleProvenance {\n if (entry.distribution !== ModuleDistribution.REGISTRY || !entry.registryId || !entry.registryUrl || !entry.artifactDigest) {\n throw new Error(\n `\"${entry.moduleId}\" was installed from the framework checkout (${entry.distribution}), not from a registry, `\n + 'so it has no registry to return to. Run the command inside the framework checkout, or remove it and add it from a registry.',\n );\n }\n return { registryId: entry.registryId, registryUrl: entry.registryUrl, artifactDigest: entry.artifactDigest };\n}\n\n/** The checkout provenance of a LOCAL_CHECKOUT entry, or a refusal naming the entry's real origin. */\nexport function localCheckoutProvenanceOf(entry: RegistryModulesLockEntry): LocalCheckoutModuleProvenance {\n if (entry.distribution !== ModuleDistribution.LOCAL_CHECKOUT || entry.checkoutCommit === undefined || entry.checkoutDirty === undefined) {\n throw new Error(`\"${entry.moduleId}\" was installed from a registry (${entry.distribution}), not from the framework checkout.`);\n }\n return { checkoutCommit: entry.checkoutCommit, checkoutDirty: entry.checkoutDirty };\n}\n\n/**\n * `sections.modules` payload. `installed` is keyed by module id.\n *\n * Wrapper kept as a `z.strictObject` so reviewers can find every\n * place that adds a new top-level field; future extensions stay\n * explicit.\n */\nexport const RegistryModulesLockSectionSchema = z.strictObject({\n installed: z.record(z.string().min(1), RegistryModulesLockEntrySchema).default({}),\n}).refine(\n // Commands look an entry up by its KEY and then build paths from it, so a key that disagrees with\n // the validated `moduleId` inside would smuggle an unvalidated name into a path.\n (section) => Object.entries(section.installed).every(([key, entry]) => key === entry.moduleId),\n { error: 'every sections.modules.installed key must equal its entry\\'s moduleId' },\n);\nexport type RegistryModulesLockSection = z.infer<typeof RegistryModulesLockSectionSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"lockfile-modules-section.schemas.js","sourceRoot":"","sources":["../../../../src/registry/lockfile-modules-section.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE9I;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAGzF;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBAcX;AAdD,WAAY,kBAAkB;IAC5B;;;;OAIG;IACH,2CAAqB,CAAA;IACrB;;;;;OAKG;IACH,uDAAiC,CAAA;AACnC,CAAC,EAdW,kBAAkB,KAAlB,kBAAkB,QAc7B;AAED,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,8B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I,KAAK,CAAC,QAAQ,oCAAoC,KAAK,CAAC,YAAY,qCAAqC,CAAC,CAAC;IACjI,CAAC;IACD,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;AACtF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7D,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACnF,CAAC,CAAC,MAAM;AACP,kGAAkG;AAClG,iFAAiF;AACjF,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,QAAQ,CAAC,EAC9F,EAAE,KAAK,EAAE,uEAAuE,EAAE,CACnF,CAAC","sourcesContent":["/**\n * `sections.modules` lockfile section — installed-code state for the\n * Wildo module registry.\n *\n * Owns the durable record of which modules a SaaS app has installed,\n * which exact version + artifact digest is on disk, and which files\n * the registry copied in. Sibling lockfile sections (`providers`,\n * `i18n`) live next to this one under the canonical\n * `wildo-saas.lock.json` envelope and are NEVER touched by code that\n * mutates `sections.modules`.\n *\n * The shape mirrors `module-registry-analysis.md` KD-4 / \"Lockfile\n * Shape\". Fields are intentionally minimal at Phase 0.5 — additional\n * fields must be justified by install/update behavior rather than\n * added preemptively.\n */\n\nimport { z } from 'zod';\nimport { Sha256DigestSchema } from './digest.schemas';\nimport { isModuleOwnedFilePath, ModuleIdSchema, ModuleManifestRegistrationSchema, RegistryDomainSlugSchema } from './module-manifest.schemas';\n\n/**\n * Source label recorded with each lockfile entry. Distinguishes\n * registry-installed code from `adopt`-promoted local code; lets the\n * `update`/`remove` flows decide whether overwriting is a safe\n * round-trip or a destructive operation.\n */\nexport const RegistryModulesInstallSourceSchema = z.enum(['install', 'update', 'adopt']);\nexport type RegistryModulesInstallSource = z.infer<typeof RegistryModulesInstallSourceSchema>;\n\n/**\n * Where an installed module's bytes came from (#2015). Distinct from `source` (install | update | adopt),\n * which records the ACTION that wrote the entry; this records the ORIGIN, and each origin carries\n * different provenance.\n */\nexport enum ModuleDistribution {\n /**\n * Downloaded from a registry server. Provenance: `registryId`, `registryUrl` and `artifactDigest` (the\n * pinned artifact, whose bytes never change for a version). The kind of every entry written before\n * #2015, which is why an entry that omits `distribution` reads as REGISTRY.\n */\n REGISTRY = 'registry',\n /**\n * Staged from the framework checkout's own source (`providers-registry/<ref>/`, see\n * `local-checkout-source.ts`) in framework development. There is no artifact and no digest: the\n * provenance is the checkout commit, plus whether the module's source had uncommitted changes when it\n * was staged, because then the commit alone does not describe the bytes.\n */\n LOCAL_CHECKOUT = 'local-checkout',\n}\n\n/** A full git commit id, as `git rev-parse HEAD` prints it. */\nconst GIT_COMMIT_REGEX = /^[0-9a-f]{40}$/;\n\n/**\n * One installed-module record. Keyed by module id in\n * `RegistryModulesLockSectionSchema.installed`.\n *\n * The provenance fields depend on {@link ModuleDistribution}: a REGISTRY entry carries `registryId`,\n * `registryUrl` and `artifactDigest`; a LOCAL_CHECKOUT entry carries `checkoutCommit` and\n * `checkoutDirty` and none of the registry fields. Read them through {@link registryProvenanceOf} /\n * {@link localCheckoutProvenanceOf}, which refuse the other kind rather than returning `undefined`.\n */\nexport const RegistryModulesLockEntrySchema = z.strictObject({\n /** Module id, mirrors the manifest's `id` (e.g. `acme/billing`). */\n moduleId: ModuleIdSchema,\n /** Where the module came from. Absent reads as REGISTRY (every entry before #2015). */\n distribution: z.enum(ModuleDistribution).default(ModuleDistribution.REGISTRY),\n /** REGISTRY only. Registry id from `wildo.saas.config.ts > moduleRegistries[].id`. */\n registryId: z.string().min(1).optional(),\n /** REGISTRY only. Resolved registry URL at install time. Stored for audit + repair. */\n registryUrl: z.string().min(1).optional(),\n /** LOCAL_CHECKOUT only. The framework checkout's commit when the module was staged. */\n checkoutCommit: z.string().regex(GIT_COMMIT_REGEX).optional(),\n /** LOCAL_CHECKOUT only. Whether the module's source had uncommitted changes when it was staged. */\n checkoutDirty: z.boolean().optional(),\n /** Domain segment under the registry (e.g. `acme`). */\n domain: RegistryDomainSlugSchema,\n /** Concrete resolved semver — never a range. */\n version: z.string().min(1),\n /** Original CLI input (e.g. `^1.2.0`), kept for diff visibility. */\n requestedRange: z.string().min(1).optional(),\n /**\n * REGISTRY only. Artifact integrity digest, format `sha256:<64-hex-lowercase>`.\n * Must match `ModuleVersionRecord.integrity` for the same artifact\n * — both fields share `Sha256DigestSchema` so a Phase 5 install\n * compares like-for-like (M-2.5).\n */\n artifactDigest: Sha256DigestSchema.optional(),\n /** ISO datetime of install for audit-log purposes. */\n installedAt: z.iso.datetime({ offset: true }),\n /**\n * File paths copied into app source, relative to saas-root (POSIX separators).\n *\n * Each entry must be a file a module can own ({@link isModuleOwnedFilePath}): below a layer root,\n * with no dot-segment or `node_modules`. `wildo registry remove` and `update` DELETE these paths.\n * The lockfile is committed, merged and hand-edited, so an unconstrained string here — `\".\"`,\n * `\"..\"`, `\"/\"`, `\"wildo.saas.config.ts\"` — was a delete of the application's own files waiting for\n * one bad merge. Refusing at parse time means a poisoned entry stops every registry command before\n * any file is touched.\n */\n files: z.array(z.string().min(1).refine(isModuleOwnedFilePath, {\n error: 'module file entries must be application-relative POSIX paths below a module layer root, with no segment that starts with `.` or is `node_modules`',\n })).default([]),\n /**\n * The SHA-256 of each file as the installer last WROTE it (#2016), keyed by the paths in `files`.\n *\n * A copied module is the application's to edit (the shadcn model), so `update`, `remove` and `repair`\n * must know which files the user changed before they overwrite or delete one: equal to this hash\n * means untouched and safe to replace; different means edited and kept, with a warning.\n *\n * Deliberately a separate map beside `files` rather than a reshape of it. `files` is OWNERSHIP, a\n * security rule (`remove` deletes those paths), and stays strictly validated; this is a fingerprint,\n * and is read TOLERANTLY: a malformed map reads as absent, and a path with no valid hash is treated as\n * edited. A bad fingerprint can only make a command more careful, never unable to run.\n *\n * Not a ledger in the one-source-of-truth sense: it lives in the committed lockfile, so it branches\n * and merges with the files it describes, and it never gates boot, `config sync` or a build.\n * Precedent: Debian and RPM conffile handling.\n */\n installedFileHashes: z.record(z.string(), z.string()).optional().catch(undefined),\n /** Provenance flag — install vs update vs adopt. */\n source: RegistryModulesInstallSourceSchema.optional(),\n /**\n * The registration the install APPLIED to the host's registries, so `remove` reverses exactly those\n * edits and `update` can tell whether it changed. Absent = nothing was registered (the module has no\n * registration, or it was installed before registration existed).\n */\n registration: ModuleManifestRegistrationSchema.optional(),\n}).superRefine((entry, context) => {\n const registryFields = (['registryId', 'registryUrl', 'artifactDigest'] as const).filter((field) => entry[field] !== undefined);\n const checkoutFields = (['checkoutCommit', 'checkoutDirty'] as const).filter((field) => entry[field] !== undefined);\n if (entry.distribution === ModuleDistribution.REGISTRY) {\n for (const field of ['registryId', 'registryUrl', 'artifactDigest'] as const) {\n if (entry[field] === undefined) context.addIssue({ code: 'custom', path: [field], message: `a registry-distributed entry records its ${field}` });\n }\n for (const field of checkoutFields) context.addIssue({ code: 'custom', path: [field], message: `${field} belongs to a local-checkout entry` });\n return;\n }\n for (const field of ['checkoutCommit', 'checkoutDirty'] as const) {\n if (entry[field] === undefined) context.addIssue({ code: 'custom', path: [field], message: `a local-checkout entry records its ${field}` });\n }\n for (const field of registryFields) context.addIssue({ code: 'custom', path: [field], message: `${field} belongs to a registry-distributed entry` });\n});\nexport type RegistryModulesLockEntry = z.infer<typeof RegistryModulesLockEntrySchema>;\n/**\n * What a writer supplies: the entry BEFORE parsing, where defaulted fields (`distribution`, `files`) may\n * be omitted. Writers go through `RegistryLockfileService.upsertEntry`, which parses it, so a default is\n * applied in one place rather than restated at every call site.\n */\nexport type RegistryModulesLockEntryInput = z.input<typeof RegistryModulesLockEntrySchema>;\n\n/** The provenance of a REGISTRY entry. */\nexport interface RegistryModuleProvenance {\n registryId: string;\n registryUrl: string;\n artifactDigest: string;\n}\n\n/** The provenance of a LOCAL_CHECKOUT entry. */\nexport interface LocalCheckoutModuleProvenance {\n checkoutCommit: string;\n checkoutDirty: boolean;\n}\n\n/**\n * The registry an entry was downloaded from, or a refusal naming the entry's real origin. The one way\n * a command reads the registry fields: a local-checkout entry has none, and silently treating it as a\n * registry install would send `update` or `repair` to a server that never served it.\n */\nexport function registryProvenanceOf(entry: RegistryModulesLockEntry): RegistryModuleProvenance {\n if (entry.distribution !== ModuleDistribution.REGISTRY || !entry.registryId || !entry.registryUrl || !entry.artifactDigest) {\n throw new Error(\n `\"${entry.moduleId}\" was installed from the framework checkout (${entry.distribution}), not from a registry, `\n + 'so it has no registry to return to. Run the command inside the framework checkout, or remove it and add it from a registry.',\n );\n }\n return { registryId: entry.registryId, registryUrl: entry.registryUrl, artifactDigest: entry.artifactDigest };\n}\n\n/** The checkout provenance of a LOCAL_CHECKOUT entry, or a refusal naming the entry's real origin. */\nexport function localCheckoutProvenanceOf(entry: RegistryModulesLockEntry): LocalCheckoutModuleProvenance {\n if (entry.distribution !== ModuleDistribution.LOCAL_CHECKOUT || entry.checkoutCommit === undefined || entry.checkoutDirty === undefined) {\n throw new Error(`\"${entry.moduleId}\" was installed from a registry (${entry.distribution}), not from the framework checkout.`);\n }\n return { checkoutCommit: entry.checkoutCommit, checkoutDirty: entry.checkoutDirty };\n}\n\n/**\n * `sections.modules` payload. `installed` is keyed by module id.\n *\n * Wrapper kept as a `z.strictObject` so reviewers can find every\n * place that adds a new top-level field; future extensions stay\n * explicit.\n */\nexport const RegistryModulesLockSectionSchema = z.strictObject({\n installed: z.record(z.string().min(1), RegistryModulesLockEntrySchema).default({}),\n}).refine(\n // Commands look an entry up by its KEY and then build paths from it, so a key that disagrees with\n // the validated `moduleId` inside would smuggle an unvalidated name into a path.\n (section) => Object.entries(section.installed).every(([key, entry]) => key === entry.moduleId),\n { error: 'every sections.modules.installed key must equal its entry\\'s moduleId' },\n);\nexport type RegistryModulesLockSection = z.infer<typeof RegistryModulesLockSectionSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-artifact.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"module-artifact.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/module-artifact.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIpC,iEAAiE;;IAEjE,4DAA4D;;IAE5D,gEAAgE;;;IAGhE;;;;;;;OAOG;;IAEH,6EAA6E;;;IAG7E;;;;OAIG;;kBAEH,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAC7D,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE,eAAO,MAAM,wBAAwB;;;iBAGnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B;;;;;iBAKvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|