@wildo-ai/platform-config-lib 1.1.5 → 1.1.6
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/bootstrap/bootstrap.contracts.d.ts +3 -2
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +3 -2
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +47 -0
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +8 -0
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts +37 -0
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js +43 -0
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js +8 -4
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +36 -3
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js +36 -13
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/lockfile-io.d.ts +7 -1
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +17 -3
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +27 -6
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +23 -10
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +455 -6
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +27 -0
- 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 +13 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js +56 -0
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -0
- package/dist/esm/project-config/define-infra-env-config.d.ts +0 -27
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +0 -2
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +52 -0
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +65 -15
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts +3 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +3 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +11 -0
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +34 -7
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts +23 -0
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -0
- package/dist/esm/project-config/npm-version-range.js +175 -0
- package/dist/esm/project-config/npm-version-range.js.map +1 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts +256 -30
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +719 -40
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +125 -2
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +283 -66
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.d.ts +157 -0
- package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -0
- package/dist/esm/project-config/shared/backing-service-servability.js +256 -0
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -0
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +62 -67
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +71 -68
- package/dist/esm/project-config/shared/backing-services.schemas.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 +41 -2
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +180 -4
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js +40 -0
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.d.ts +26 -0
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -0
- package/dist/esm/project-config/static-asset-import-noop.js +49 -0
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -0
- package/dist/esm/registry/companion-api.schemas.d.ts +0 -176
- package/dist/esm/registry/companion-api.schemas.d.ts.map +0 -1
- package/dist/esm/registry/companion-api.schemas.js.map +0 -1
- package/dist/esm/registry/index.d.ts +3 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js +3 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts +31 -0
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -0
- package/dist/esm/registry/local-checkout-source.js +45 -0
- package/dist/esm/registry/local-checkout-source.js.map +1 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +174 -14
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js +120 -11
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts +79 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js +36 -0
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +393 -7
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +488 -40
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts +80 -0
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -0
- package/dist/esm/registry/module-search.schemas.js +112 -0
- package/dist/esm/registry/module-search.schemas.js.map +1 -0
- package/dist/esm/registry/registry-config.schemas.d.ts +16 -0
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js +8 -0
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts +126 -2
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js +183 -14
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.d.ts +80 -0
- package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -0
- package/dist/esm/registry/registry-keys.schemas.js +68 -0
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +25 -3
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +13 -11
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js +2 -2
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/package.json +7 -7
- package/dist/esm/registry/companion-api.schemas.js +0 -165
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-manifest.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/module-manifest.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"module-manifest.schemas.d.ts","sourceRoot":"","sources":["../../../../src/registry/module-manifest.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAqC,YAAY,EAAkC,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAUhK;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QACwJ,CAAC;AACxL,eAAO,MAAM,iBAAiB,aAGK,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,uCAA2C,CAAC;AAC/F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AAEtG;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC;;;kBAG9C,CAAC;AACH,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AC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;QAzF7B;;;WAGG;;QAEH,gHAAgH;;QAEhH,6EAA6E;;;;;QAE7E,+FAA+F;;QAE/F;;;WAGG;;;;gBAKG;;;;mBAIG;;;;;QAMT,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAvJ9E,0HAA0H;;QAE1H,+GAA+G;;QAE/G;;;;WAIG;;QAEH,iFAAiF;;YAhEnF,iHAAiH;;;;;;YAGjH,sFAAsF;;;;;;;;;kCAiUtF,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* downstream by Phase 5+ verification, not the manifest itself.
|
|
17
17
|
*/
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
+
import { AppFrontendType, ProviderCatalogueProvenanceSchema, ProviderTier, engineSlotsBoundByCapabilities } from '@wildo-ai/saas-models';
|
|
19
20
|
/**
|
|
20
21
|
* Authoring shape for a nonempty version constraint. Registry release selectors
|
|
21
22
|
* can resolve tags; manifest module/framework requirements instead use npm
|
|
@@ -78,50 +79,453 @@ export const ModuleManifestEngineSchema = z.strictObject({
|
|
|
78
79
|
framework: SemverRange,
|
|
79
80
|
});
|
|
80
81
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return false;
|
|
100
|
-
// Reject `..` segments after normalizing path separators.
|
|
101
|
-
const segments = s.split(/[\\/]/);
|
|
102
|
-
return !segments.includes('..');
|
|
103
|
-
}, {
|
|
104
|
-
error: 'boundary entries must be relative to the saas root and contain no `..` segments ' +
|
|
105
|
-
'(e.g. `app/src/modules/acme-billing`, NOT `/app/src/modules/acme-billing` or `../escape`)',
|
|
82
|
+
* One registry NAME segment — a domain slug, or either half of a module id. Lowercase ASCII letters,
|
|
83
|
+
* digits, `.`, `_`, `-`, not starting with `.`, `_` or `-` (npm's package-name alphabet).
|
|
84
|
+
*
|
|
85
|
+
* These names are not only identifiers: the CLI builds filesystem paths from them
|
|
86
|
+
* (`.wildo-saas/generated/modules-artifacts/<domain>/<scope>/<name>/…`) and runs a RECURSIVE delete
|
|
87
|
+
* on those paths to wipe a stale staging or extraction tree. Until 2026-09-25 the only rule on a
|
|
88
|
+
* module id was "contains a `/`", so a manifest `id` of `a/../../../..` made `wildo registry publish`
|
|
89
|
+
* resolve its staging root to the application root and delete it. The rule is total over both
|
|
90
|
+
* places a name is authored: a module's manifest, and a domain created on the registry server.
|
|
91
|
+
*/
|
|
92
|
+
const REGISTRY_NAME_SEGMENT_REGEX = /^[a-z0-9][a-z0-9._-]*$/;
|
|
93
|
+
const REGISTRY_NAME_SEGMENT_MAX_LENGTH = 64;
|
|
94
|
+
function isRegistryNameSegment(segment) {
|
|
95
|
+
return segment.length <= REGISTRY_NAME_SEGMENT_MAX_LENGTH && REGISTRY_NAME_SEGMENT_REGEX.test(segment);
|
|
96
|
+
}
|
|
97
|
+
/** A registry domain slug (`acme`, `internal`) — one {@link isRegistryNameSegment} segment. */
|
|
98
|
+
export const RegistryDomainSlugSchema = z.string().refine(isRegistryNameSegment, {
|
|
99
|
+
error: 'a registry domain must be lowercase letters, digits, `.`, `_` or `-`, starting with a letter or digit (max 64)',
|
|
106
100
|
});
|
|
101
|
+
/** Whether `moduleId` is a well-formed `<scope>/<name>` module id. */
|
|
102
|
+
export function isModuleId(moduleId) {
|
|
103
|
+
const segments = moduleId.split('/');
|
|
104
|
+
return segments.length === 2 && segments.every(isRegistryNameSegment);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A module id: exactly `<scope>/<name>` (e.g. `acme/billing`), each half a registry name segment.
|
|
108
|
+
* The id is also the lockfile key, the registry URL segment, and — through the CLI — a directory
|
|
109
|
+
* path, so its shape is the path-safety rule, not a style preference.
|
|
110
|
+
*/
|
|
111
|
+
export const ModuleIdSchema = z.string().refine(isModuleId, {
|
|
112
|
+
error: 'a module id must be `<scope>/<name>` (e.g. `acme/billing`), each half lowercase letters, digits, `.`, `_` or `-`',
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Where each layer's MODULE directories live in a Wildo SaaS application, relative to its root.
|
|
116
|
+
*
|
|
117
|
+
* Derived from the scaffold, not invented: the `add-module` scenario creates a module's directories
|
|
118
|
+
* under `shared-lib/src/modules/<id>`, `specifications/src/modules/<id>`, `frontend/src/modules/<id>`
|
|
119
|
+
* and `backend-api/src/modules/<id>`; `add-minion` and `add-worker-node` create a package directory
|
|
120
|
+
* under `minions/<dir>` and `workers/<dir>`.
|
|
121
|
+
*
|
|
122
|
+
* A registry module may write only BELOW one of these roots, in a directory it names. That is the
|
|
123
|
+
* whole of KD-12, stated positively. Until 2026-09-25 the boundary rule refused only absolute paths
|
|
124
|
+
* and `..` segments, so `.`, `.git/hooks`, `.wildo-saas` and `wildo.saas.config.ts` were all valid
|
|
125
|
+
* boundaries: a published module could overwrite the host's configuration or plant a git hook, and
|
|
126
|
+
* `wildo registry publish` would ship the author's `.env` and `secrets.json`.
|
|
127
|
+
*/
|
|
128
|
+
export const MODULE_BOUNDARY_LAYER_ROOTS = {
|
|
129
|
+
specifications: 'specifications/src/modules',
|
|
130
|
+
shared: 'shared-lib/src/modules',
|
|
131
|
+
frontend: 'frontend/src/modules',
|
|
132
|
+
backend: 'backend-api/src/modules',
|
|
133
|
+
minions: 'minions',
|
|
134
|
+
workers: 'workers',
|
|
135
|
+
/**
|
|
136
|
+
* A PROVIDER module's directory, `providers/<ref>` (#2014), holding one workspace package per facet
|
|
137
|
+
* (`providers/<ref>/backend`, `providers/<ref>/frontend`). Like a minion or a worker, each facet is its
|
|
138
|
+
* own package, so the root is a top-level directory rather than a layer's `src/modules`: the facet's own
|
|
139
|
+
* `package.json` is where its vendor SDK dependency lives, and a runtime depends only on the facet it runs.
|
|
140
|
+
*/
|
|
141
|
+
providers: 'providers',
|
|
142
|
+
};
|
|
143
|
+
/** Every boundary layer, in the canonical order of {@link MODULE_BOUNDARY_LAYER_ROOTS}. */
|
|
144
|
+
export const MODULE_BOUNDARY_LAYERS = Object.keys(MODULE_BOUNDARY_LAYER_ROOTS);
|
|
145
|
+
/**
|
|
146
|
+
* Directory names a module artifact may never contain, at any depth: dependency installs are the
|
|
147
|
+
* consumer's to produce, never the publisher's to ship.
|
|
148
|
+
*/
|
|
149
|
+
const MODULE_ARTIFACT_FORBIDDEN_SEGMENTS = new Set(['node_modules']);
|
|
150
|
+
/**
|
|
151
|
+
* Whether one `/`-separated path segment may appear in a module boundary or a module artifact.
|
|
152
|
+
*
|
|
153
|
+
* A DOT-prefixed segment is refused outright. That single rule removes `.git` (hooks run code on the
|
|
154
|
+
* next commit), `.env` (a minion or worker package carries its generated secrets there),
|
|
155
|
+
* `.wildo-saas` (the companion and machine-local state) and `..` / `.` (traversal and "the whole
|
|
156
|
+
* root"). npm applies the same default for the same reason: `.git` and the like never enter a
|
|
157
|
+
* published package.
|
|
158
|
+
*/
|
|
159
|
+
function isAllowedModulePathSegment(segment) {
|
|
160
|
+
return segment.length > 0 && !segment.startsWith('.') && !MODULE_ARTIFACT_FORBIDDEN_SEGMENTS.has(segment);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Whether `appRelativePath` (POSIX separators, relative to the application root) may be carried by a
|
|
164
|
+
* module artifact. Used on BOTH sides of the registry so they cannot disagree:
|
|
165
|
+
*
|
|
166
|
+
* - `wildo registry publish` skips a file that fails it, so a secret beside the module's source is
|
|
167
|
+
* never packed;
|
|
168
|
+
* - `wildo registry add` / `update` / `repair` refuse an artifact containing one, before writing
|
|
169
|
+
* anything — a correctly published artifact cannot contain it, so its presence means the bytes
|
|
170
|
+
* did not come from `publish`.
|
|
171
|
+
*/
|
|
172
|
+
export function isModuleArtifactPathAllowed(appRelativePath) {
|
|
173
|
+
if (appRelativePath.includes('\\') || appRelativePath.startsWith('/'))
|
|
174
|
+
return false;
|
|
175
|
+
return appRelativePath.split('/').every(isAllowedModulePathSegment);
|
|
176
|
+
}
|
|
107
177
|
/**
|
|
108
|
-
* `
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
178
|
+
* Whether `appRelativePath` is a file a registry module can OWN in an application: a path a module
|
|
179
|
+
* artifact may carry ({@link isModuleArtifactPathAllowed}) that also sits strictly below one of the
|
|
180
|
+
* layer roots ({@link MODULE_BOUNDARY_LAYER_ROOTS}) — because an install only ever writes inside a
|
|
181
|
+
* boundary, and every boundary lives there.
|
|
112
182
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
183
|
+
* This is the rule for a path RECORDED as installed (`sections.modules.installed[*].files`), which
|
|
184
|
+
* `remove` and `update` delete. `isModuleArtifactPathAllowed` alone would let a hand-edited or badly
|
|
185
|
+
* merged entry name `wildo.saas.config.ts` or `backend-api/src/index.ts`, and removing the module would
|
|
186
|
+
* then delete the application's own file.
|
|
187
|
+
*/
|
|
188
|
+
export function isModuleOwnedFilePath(appRelativePath) {
|
|
189
|
+
return isModuleArtifactPathAllowed(appRelativePath)
|
|
190
|
+
&& Object.values(MODULE_BOUNDARY_LAYER_ROOTS).some((root) => appRelativePath.startsWith(`${root}/`));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* One layer's `boundaries` entries: each a directory strictly BELOW that layer's root
|
|
194
|
+
* ({@link MODULE_BOUNDARY_LAYER_ROOTS}), written with POSIX separators, every segment allowed by
|
|
195
|
+
* {@link isModuleArtifactPathAllowed}. Validated at parse time, so the registry server refuses a
|
|
196
|
+
* manifest declaring a wider boundary at publish and the CLI refuses one at install.
|
|
197
|
+
*/
|
|
198
|
+
function moduleLayerBoundariesSchema(layer) {
|
|
199
|
+
const root = MODULE_BOUNDARY_LAYER_ROOTS[layer];
|
|
200
|
+
return z.array(z.string().min(1).refine((entry) => isModuleArtifactPathAllowed(entry) && entry.startsWith(`${root}/`) && entry.length > root.length + 1, {
|
|
201
|
+
error: `boundaries.${layer} entries must name a directory below \`${root}/\` (e.g. \`${root}/acme-billing\`), ` +
|
|
202
|
+
'with `/` separators and no segment that starts with `.` or is `node_modules`',
|
|
203
|
+
})).default([]);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* `boundaries` — the per-layer surface the module is allowed to write into the host app source
|
|
207
|
+
* (KD-12). Each layer is optional; modules typically declare only the layers they actually contain
|
|
208
|
+
* (a backend-only module declares `backend` + `shared` and omits `frontend` / `specifications`).
|
|
116
209
|
*/
|
|
117
210
|
export const ModuleManifestBoundariesSchema = z.strictObject({
|
|
118
|
-
specifications:
|
|
119
|
-
shared:
|
|
120
|
-
frontend:
|
|
121
|
-
backend:
|
|
122
|
-
minions:
|
|
123
|
-
workers:
|
|
211
|
+
specifications: moduleLayerBoundariesSchema('specifications'),
|
|
212
|
+
shared: moduleLayerBoundariesSchema('shared'),
|
|
213
|
+
frontend: moduleLayerBoundariesSchema('frontend'),
|
|
214
|
+
backend: moduleLayerBoundariesSchema('backend'),
|
|
215
|
+
minions: moduleLayerBoundariesSchema('minions'),
|
|
216
|
+
workers: moduleLayerBoundariesSchema('workers'),
|
|
217
|
+
providers: moduleLayerBoundariesSchema('providers'),
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* The boundaries schema declares every layer of {@link MODULE_BOUNDARY_LAYER_ROOTS} and nothing else: a
|
|
221
|
+
* root added without its boundaries key (or the reverse) fails to compile here.
|
|
222
|
+
*/
|
|
223
|
+
export const BOUNDARIES_SCHEMA_COVERS_EVERY_LAYER = true;
|
|
224
|
+
/**
|
|
225
|
+
* Every boundary directory a manifest declares, across ALL layers, in canonical layer order.
|
|
226
|
+
*
|
|
227
|
+
* The one place a consumer turns `boundaries` into a list. Three consumers (the packager, `publish`, the
|
|
228
|
+
* install fan-out) each used to spell the six layers out by hand, so a seventh layer — `providers`,
|
|
229
|
+
* #2014 — would have been silently skipped by all three: an artifact that packs nothing, an install that
|
|
230
|
+
* copies nothing, and a publish that reports success. Iterating the roots makes the next layer impossible
|
|
231
|
+
* to forget.
|
|
232
|
+
*/
|
|
233
|
+
export function flattenModuleBoundaries(boundaries) {
|
|
234
|
+
if (!boundaries)
|
|
235
|
+
return [];
|
|
236
|
+
return MODULE_BOUNDARY_LAYERS.flatMap((layer) => boundaries[layer] ?? []);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* How an installed module is REGISTERED in the host application — the composition scenario whose
|
|
240
|
+
* registry edits make it a module the application knows about (#1755, #1773).
|
|
241
|
+
*
|
|
242
|
+
* Installing copies a module's files; registering it adds it to what the application declares. Without
|
|
243
|
+
* registration the backend discovers `backend-api/src/modules/<dir>` by directory scan while every other
|
|
244
|
+
* layer ignores the module, and a minion or worker is never declared at all, so it never runs.
|
|
245
|
+
*
|
|
246
|
+
* Each member is the framework scenario that IS the declaration of how that shape is registered, so
|
|
247
|
+
* installation replays its edit steps rather than keeping a second copy of them:
|
|
248
|
+
*/
|
|
249
|
+
export var ModuleRegistrationScenario;
|
|
250
|
+
(function (ModuleRegistrationScenario) {
|
|
251
|
+
/** A domain module — its shared, specifications and frontend registries and `applicationModules`. */
|
|
252
|
+
ModuleRegistrationScenario["ADD_MODULE"] = "add-module";
|
|
253
|
+
/** A minion — `applicationMinions`, its provider scope, and the pnpm workspace member. */
|
|
254
|
+
ModuleRegistrationScenario["ADD_MINION"] = "add-minion";
|
|
255
|
+
/** A worker node — `applicationWorkers`, its provider scope, and the pnpm workspace member. */
|
|
256
|
+
ModuleRegistrationScenario["ADD_WORKER_NODE"] = "add-worker-node";
|
|
257
|
+
/**
|
|
258
|
+
* A provider module (#2014): the pnpm workspace member, each facet package as a `workspace:*` dependency of the
|
|
259
|
+
* runtimes that own that facet, and the provider's scope in each. Unlike the three above it is never carried by a
|
|
260
|
+
* MANIFEST: the owners are the INSTALLING application's, so the installer derives the wiring and only its lockfile
|
|
261
|
+
* records it ({@link ProviderWiringSchema}).
|
|
262
|
+
*/
|
|
263
|
+
ModuleRegistrationScenario["ADD_PROVIDER_PACKAGE"] = "add-provider-package";
|
|
264
|
+
})(ModuleRegistrationScenario || (ModuleRegistrationScenario = {}));
|
|
265
|
+
/**
|
|
266
|
+
* An application-relative service directory as `wildo.saas.config.ts` declares it (`./backend-api`, `frontend`).
|
|
267
|
+
* Restricted to plain path segments, with no `..`, because a wiring names files the installer and `remove` edit.
|
|
268
|
+
*/
|
|
269
|
+
const WIRED_SERVICE_PATH_PATTERN = /^(\.\/)?(?!\.\.?(\/|$))[A-Za-z0-9_-][A-Za-z0-9._-]*(\/(?!\.\.?(\/|$))[A-Za-z0-9_-][A-Za-z0-9._-]*)*$/;
|
|
270
|
+
/** A scoped provider facet package name: `@<scope>/provider-<ref>` or `@<scope>/provider-<ref>-frontend`. */
|
|
271
|
+
const PROVIDER_FACET_PACKAGE_NAME_PATTERN = /^@[a-z0-9][a-z0-9._-]*\/provider-[a-z][a-z0-9-]*$/;
|
|
272
|
+
/** One runtime a provider facet was wired into: its key in `services`, and its directory. */
|
|
273
|
+
export const ProviderWiringOwnerSchema = z.strictObject({
|
|
274
|
+
serviceKey: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/),
|
|
275
|
+
path: z.string().regex(WIRED_SERVICE_PATH_PATTERN),
|
|
276
|
+
});
|
|
277
|
+
/**
|
|
278
|
+
* What an `add-provider-package` install wired, as the INSTALLER derived it from its own application (#2014):
|
|
279
|
+
* - `backendOwners`: the backend services that depend on the backend facet and scope the provider;
|
|
280
|
+
* - `frontendOwners`: the frontend services, of a type in the facet's `surfaces`, that depend on the browser facet
|
|
281
|
+
* and scope the provider.
|
|
282
|
+
*
|
|
283
|
+
* Recorded so `remove` reverses exactly what install wrote, even after the application's services change.
|
|
284
|
+
*/
|
|
285
|
+
export const ProviderWiringSchema = z.strictObject({
|
|
286
|
+
/** The backend facet's package name as installed (`@<scope>/provider-<ref>`); absent without a backend facet. */
|
|
287
|
+
backendPackage: z.string().regex(PROVIDER_FACET_PACKAGE_NAME_PATTERN).optional(),
|
|
288
|
+
backendOwners: z.array(ProviderWiringOwnerSchema),
|
|
289
|
+
/** The browser facet's package name as installed; absent without a frontend facet. */
|
|
290
|
+
frontendPackage: z.string().regex(PROVIDER_FACET_PACKAGE_NAME_PATTERN).optional(),
|
|
291
|
+
frontendOwners: z.array(ProviderWiringOwnerSchema),
|
|
292
|
+
});
|
|
293
|
+
/**
|
|
294
|
+
* The four layers of a domain module, named as its manifest boundaries name them. A domain-module
|
|
295
|
+
* registration may cover a SUBSET (#1773): a backend+shared module registers its shared entries and an
|
|
296
|
+
* `applicationModules` entry bound to the backend only.
|
|
297
|
+
*/
|
|
298
|
+
export var DomainModuleLayer;
|
|
299
|
+
(function (DomainModuleLayer) {
|
|
300
|
+
DomainModuleLayer["SHARED"] = "shared";
|
|
301
|
+
DomainModuleLayer["SPECIFICATIONS"] = "specifications";
|
|
302
|
+
DomainModuleLayer["FRONTEND"] = "frontend";
|
|
303
|
+
DomainModuleLayer["BACKEND"] = "backend";
|
|
304
|
+
})(DomainModuleLayer || (DomainModuleLayer = {}));
|
|
305
|
+
/**
|
|
306
|
+
* Every domain layer is a boundary layer, spelled the same (#1773 review): the enum restates four keys of
|
|
307
|
+
* `MODULE_BOUNDARY_LAYER_ROOTS`, so a member added or renamed on one side alone fails to compile here.
|
|
308
|
+
*/
|
|
309
|
+
export const DOMAIN_LAYERS_ARE_BOUNDARY_LAYERS = true;
|
|
310
|
+
/** Canonical order, so one set of layers has one spelling. */
|
|
311
|
+
export const DOMAIN_MODULE_LAYERS = [
|
|
312
|
+
DomainModuleLayer.SHARED,
|
|
313
|
+
DomainModuleLayer.SPECIFICATIONS,
|
|
314
|
+
DomainModuleLayer.FRONTEND,
|
|
315
|
+
DomainModuleLayer.BACKEND,
|
|
316
|
+
];
|
|
317
|
+
/**
|
|
318
|
+
* The scenarios' variable patterns for the directory and camelCase stem their REGISTRY edits use
|
|
319
|
+
* (`moduleId`/`moduleCamel`, `minionDir`/`minionCamel`, `workerDir`/`workerCamel` share them). Mirrored
|
|
320
|
+
* here because the manifest is validated where no scenario is loaded (the registry server); a test pins
|
|
321
|
+
* them equal to the scenarios' own declarations.
|
|
322
|
+
*/
|
|
323
|
+
export const MODULE_REGISTRATION_MODULE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
324
|
+
export const MODULE_REGISTRATION_MODULE_CAMEL_PATTERN = /^[a-z][A-Za-z0-9]*$/;
|
|
325
|
+
/**
|
|
326
|
+
* A module's registration: the scenario plus the ONLY values its registry edits read. It carries no
|
|
327
|
+
* code — the installer renders the scenario's own edit steps with these values, both restricted to
|
|
328
|
+
* identifier alphabets (and anything else a scenario needs is DERIVED by the installer, never read from
|
|
329
|
+
* the manifest) — so a manifest cannot smuggle text into the host's files. Derived by
|
|
330
|
+
* `wildo registry publish` from the publishing application (every edit already present), never authored.
|
|
331
|
+
*/
|
|
332
|
+
export const ModuleManifestRegistrationSchema = z
|
|
333
|
+
.strictObject({
|
|
334
|
+
scenario: z.enum(ModuleRegistrationScenario),
|
|
335
|
+
/** The module's directory under its scenario's root: each layer's modules root, `minions/` or `workers/` (kebab-case). */
|
|
336
|
+
moduleId: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN),
|
|
337
|
+
/** The camelCase stem the scenario's entries are named from (`<stem>Module`, the minion/worker bucket key). */
|
|
338
|
+
moduleCamel: z.string().regex(MODULE_REGISTRATION_MODULE_CAMEL_PATTERN),
|
|
339
|
+
/**
|
|
340
|
+
* `add-module` only: the layers the module covers, when it is NOT all four (absent = the whole module,
|
|
341
|
+
* so one module has one spelling). Must include `backend` or `frontend`: an `applicationModules` entry
|
|
342
|
+
* binds the module to at least one service.
|
|
343
|
+
*/
|
|
344
|
+
layers: z.array(z.enum(DomainModuleLayer)).min(1).optional(),
|
|
345
|
+
/** `add-provider-package` only, and required there: what the installer wired. */
|
|
346
|
+
providerWiring: ProviderWiringSchema.optional(),
|
|
347
|
+
})
|
|
348
|
+
.superRefine((registration, context) => {
|
|
349
|
+
const isProviderWiring = registration.scenario === ModuleRegistrationScenario.ADD_PROVIDER_PACKAGE;
|
|
350
|
+
if (isProviderWiring !== (registration.providerWiring !== undefined)) {
|
|
351
|
+
context.addIssue({ code: 'custom', path: ['providerWiring'], message: 'an add-provider-package registration carries its wiring, and no other registration does' });
|
|
352
|
+
}
|
|
353
|
+
const layers = registration.layers;
|
|
354
|
+
if (layers === undefined)
|
|
355
|
+
return;
|
|
356
|
+
if (registration.scenario !== ModuleRegistrationScenario.ADD_MODULE) {
|
|
357
|
+
context.addIssue({ code: 'custom', path: ['layers'], message: 'only an add-module registration covers layers' });
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const canonical = DOMAIN_MODULE_LAYERS.filter((layer) => layers.includes(layer));
|
|
361
|
+
if (canonical.length !== layers.length || canonical.some((layer, index) => layer !== layers[index])) {
|
|
362
|
+
context.addIssue({ code: 'custom', path: ['layers'], message: `layers must be distinct and in canonical order (${DOMAIN_MODULE_LAYERS.join(', ')})` });
|
|
363
|
+
}
|
|
364
|
+
if (canonical.length === DOMAIN_MODULE_LAYERS.length) {
|
|
365
|
+
context.addIssue({ code: 'custom', path: ['layers'], message: 'a whole module omits `layers`' });
|
|
366
|
+
}
|
|
367
|
+
if (!layers.includes(DomainModuleLayer.BACKEND) && !layers.includes(DomainModuleLayer.FRONTEND)) {
|
|
368
|
+
context.addIssue({ code: 'custom', path: ['layers'], message: 'a registered module must include the backend or the frontend layer' });
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
/**
|
|
372
|
+
* What a registry module IS: the one discriminator every consumer branches on (#2014).
|
|
373
|
+
*
|
|
374
|
+
* The registry was built to carry application FEATURES. On 2026-09-29 Paul decided it also carries
|
|
375
|
+
* PROVIDERS, distributed shadcn-style: a provider's source is copied into the application, which owns it
|
|
376
|
+
* from then on. The Activepieces/Sim-generated catalogue that used to hold providers is archived (#2012).
|
|
377
|
+
* The two kinds differ in what they may contain and in how they are registered, so the difference is
|
|
378
|
+
* named rather than inferred from which boundaries happen to be present.
|
|
379
|
+
*/
|
|
380
|
+
export var ModuleKind;
|
|
381
|
+
(function (ModuleKind) {
|
|
382
|
+
/**
|
|
383
|
+
* An application feature: domain module layers, a minion or a worker. Every module published before
|
|
384
|
+
* #2014 is one, which is why a manifest that omits `kind` reads as FEATURE.
|
|
385
|
+
*/
|
|
386
|
+
ModuleKind["FEATURE"] = "feature";
|
|
387
|
+
/**
|
|
388
|
+
* One vendor's integration, installed at `providers/<ref>/` with ONE workspace package per facet
|
|
389
|
+
* ({@link ProviderModuleFacet}): each carries its own SDK dependencies in its own `package.json`, and
|
|
390
|
+
* each runtime depends only on the facet it runs. It may fill an engine capability when its tier is
|
|
391
|
+
* EXTENSION.
|
|
392
|
+
*
|
|
393
|
+
* What a provider module never is:
|
|
394
|
+
* - system-of-record facets: a separate lane, delivered by `@wildo-ai/systems-of-record` (#2013);
|
|
395
|
+
* - an INFRASTRUCTURE provider (object storage, databases, brokers, scanners): those are executed by the
|
|
396
|
+
* PLATFORM (apps-manager) with platform administrator credentials, so application-owned code must never
|
|
397
|
+
* be one. They stay in the platform's own package, selected by the application's declaration (#1692).
|
|
398
|
+
*/
|
|
399
|
+
ModuleKind["PROVIDER"] = "provider";
|
|
400
|
+
})(ModuleKind || (ModuleKind = {}));
|
|
401
|
+
/**
|
|
402
|
+
* The runtime facets a provider module can ship, each as its own workspace package under
|
|
403
|
+
* `providers/<ref>/<facet>/` (Paul, 2026-09-29).
|
|
404
|
+
*
|
|
405
|
+
* One package per facet, as the engine itself separates `external-connectors-private` (backend) from
|
|
406
|
+
* `external-connectors-public` (browser):
|
|
407
|
+
* - a Node SDK never reaches a frontend install, and a browser SDK never reaches a backend's;
|
|
408
|
+
* - each runtime owner depends on exactly the facet it runs, so imports stay unambiguous;
|
|
409
|
+
* - the browser facet cannot reach backend code unless its own manifest declares that dependency, which
|
|
410
|
+
* publish refuses. Isolation is a property of the dependency graph, not of scanning import statements.
|
|
411
|
+
*
|
|
412
|
+
* There is deliberately no INFRASTRUCTURE member: see {@link ModuleKind.PROVIDER}.
|
|
413
|
+
*/
|
|
414
|
+
export var ProviderModuleFacet;
|
|
415
|
+
(function (ProviderModuleFacet) {
|
|
416
|
+
/** Loaded by the application backend, the companion and minions. Workers load no providers. */
|
|
417
|
+
ProviderModuleFacet["BACKEND"] = "backend";
|
|
418
|
+
/** Loaded by the frontend services whose type is listed in its `surfaces`. */
|
|
419
|
+
ProviderModuleFacet["FRONTEND"] = "frontend";
|
|
420
|
+
})(ProviderModuleFacet || (ProviderModuleFacet = {}));
|
|
421
|
+
/**
|
|
422
|
+
* How far a published provider has been taken since it was adopted (#2012).
|
|
423
|
+
*
|
|
424
|
+
* There is deliberately no SEEDED member: a seed (a catalogue transposition in the archive) is never
|
|
425
|
+
* published, so the registry only ever holds providers someone adopted.
|
|
426
|
+
*/
|
|
427
|
+
export var ProviderModuleMaturity;
|
|
428
|
+
(function (ProviderModuleMaturity) {
|
|
429
|
+
/** Copied from a seed or written by hand, reviewed, and owned by Wildo. Not yet met the real vendor. */
|
|
430
|
+
ProviderModuleMaturity["ADOPTED"] = "adopted";
|
|
431
|
+
/** Has executed against the real vendor it names, with the proof recorded on the tracker. */
|
|
432
|
+
ProviderModuleMaturity["PROVEN"] = "proven";
|
|
433
|
+
})(ProviderModuleMaturity || (ProviderModuleMaturity = {}));
|
|
434
|
+
/**
|
|
435
|
+
* The tiers a PROVIDER module may declare. MAIN is the engine's own set: its origin is always ENGINE,
|
|
436
|
+
* and the tier rule (`provider-tier-rule.shared.utils.ts`) refuses MAIN from anywhere else.
|
|
437
|
+
*/
|
|
438
|
+
const PROVIDER_MODULE_TIERS = [ProviderTier.CATALOGUE, ProviderTier.EXTENSION];
|
|
439
|
+
/**
|
|
440
|
+
* The `provider` block of a PROVIDER module: what the registry must know about the provider WITHOUT
|
|
441
|
+
* executing its code, which is what server-side search and listing need.
|
|
442
|
+
*
|
|
443
|
+
* Deliberately NOT carried here, so there is one source for each fact:
|
|
444
|
+
* - the ENGINE capabilities it fills: derived from `providerCapabilities` through the same closed map the
|
|
445
|
+
* engine uses (`engineSlotsBoundByCapabilities`);
|
|
446
|
+
* - the compliance profile, secrets contract, operations and auth: they live in the module's code
|
|
447
|
+
* (`BackendProviderModule`), which discovery already reads. Publish checks that this block agrees
|
|
448
|
+
* with that code (#2014).
|
|
449
|
+
*
|
|
450
|
+
* Fields for per-provider skills, OpenAPI binding and change monitoring are added by the issues that
|
|
451
|
+
* read them (#2026, #2028, #2027), not before.
|
|
452
|
+
*/
|
|
453
|
+
export const ModuleManifestProviderSchema = z
|
|
454
|
+
.strictObject({
|
|
455
|
+
/**
|
|
456
|
+
* The provider ref: the application's scope key, the directory under `providers/`, and the suffix of
|
|
457
|
+
* the package name. One kebab-case segment, the same alphabet as a registration directory.
|
|
458
|
+
*/
|
|
459
|
+
ref: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN),
|
|
460
|
+
/** The vendor's identity, shared by every ref of one vendor. Defaults to the ref, as provider metadata does. */
|
|
461
|
+
vendor: z.string().regex(MODULE_REGISTRATION_MODULE_ID_PATTERN).optional(),
|
|
462
|
+
/** CATALOGUE (operations only) or EXTENSION (fills an engine capability). */
|
|
463
|
+
tier: z.enum(PROVIDER_MODULE_TIERS),
|
|
464
|
+
/** The provider capability tokens the module declares, as its `BackendProviderModule` does. */
|
|
465
|
+
providerCapabilities: z.array(z.string().min(1)).default([]),
|
|
466
|
+
/**
|
|
467
|
+
* The facets the module ships, each a package at `providers/<ref>/<facet>/`. At least one.
|
|
468
|
+
* Keys are {@link ProviderModuleFacet} members.
|
|
469
|
+
*/
|
|
470
|
+
facets: z.strictObject({
|
|
471
|
+
[ProviderModuleFacet.BACKEND]: z.strictObject({}).optional(),
|
|
472
|
+
[ProviderModuleFacet.FRONTEND]: z
|
|
473
|
+
.strictObject({
|
|
474
|
+
/**
|
|
475
|
+
* Which frontend surfaces the browser facet serves: the application, the public website, the
|
|
476
|
+
* documentation site. Installation adds the facet's package only to frontend services of these
|
|
477
|
+
* types. The engine composes a separate provider registry per surface, which is why it is named.
|
|
478
|
+
*/
|
|
479
|
+
surfaces: z.array(z.enum(AppFrontendType)).min(1),
|
|
480
|
+
})
|
|
481
|
+
.optional(),
|
|
482
|
+
}),
|
|
483
|
+
maturity: z.enum(ProviderModuleMaturity),
|
|
484
|
+
/** Where the adopted source came from, when it came from a catalogue seed. */
|
|
485
|
+
seed: ProviderCatalogueProvenanceSchema.optional(),
|
|
486
|
+
})
|
|
487
|
+
.superRefine((provider, context) => {
|
|
488
|
+
if (providerModuleFacets(provider).length === 0) {
|
|
489
|
+
context.addIssue({ code: 'custom', path: ['facets'], message: 'a provider module ships a backend facet, a frontend facet, or both' });
|
|
490
|
+
}
|
|
491
|
+
const surfaces = provider.facets[ProviderModuleFacet.FRONTEND]?.surfaces ?? [];
|
|
492
|
+
if (new Set(surfaces).size !== surfaces.length) {
|
|
493
|
+
context.addIssue({ code: 'custom', path: ['facets', ProviderModuleFacet.FRONTEND, 'surfaces'], message: 'each frontend surface is listed once' });
|
|
494
|
+
}
|
|
495
|
+
const boundSlots = engineSlotsBoundByCapabilities(provider.providerCapabilities);
|
|
496
|
+
if (provider.tier === ProviderTier.CATALOGUE && boundSlots.length > 0) {
|
|
497
|
+
context.addIssue({
|
|
498
|
+
code: 'custom',
|
|
499
|
+
path: ['providerCapabilities'],
|
|
500
|
+
message: `tier CATALOGUE may claim only open capability tokens, but ${boundSlots.map((entry) => `"${entry.capability}" binds the ${entry.slot} engine slot`).join(', ')}. `
|
|
501
|
+
+ 'Declare EXTENSION to fill an engine capability.',
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
if (provider.tier === ProviderTier.EXTENSION && boundSlots.length === 0) {
|
|
505
|
+
context.addIssue({
|
|
506
|
+
code: 'custom',
|
|
507
|
+
path: ['providerCapabilities'],
|
|
508
|
+
message: 'tier EXTENSION fills an engine capability, so at least one provider capability must bind an engine slot',
|
|
509
|
+
});
|
|
510
|
+
}
|
|
124
511
|
});
|
|
512
|
+
/**
|
|
513
|
+
* The facets a provider module ships, in canonical enum order, and the package directory of each.
|
|
514
|
+
* Install, publish and registration all read these rather than re-deriving the layout.
|
|
515
|
+
*/
|
|
516
|
+
export function providerModuleFacets(provider) {
|
|
517
|
+
return Object.values(ProviderModuleFacet).filter((facet) => provider.facets[facet] !== undefined);
|
|
518
|
+
}
|
|
519
|
+
/** `providers/<ref>/<facet>`: where one facet's workspace package lives. */
|
|
520
|
+
export function providerModuleFacetDirectory(ref, facet) {
|
|
521
|
+
return `${MODULE_BOUNDARY_LAYER_ROOTS.providers}/${ref}/${facet}`;
|
|
522
|
+
}
|
|
523
|
+
/** The engine capabilities a provider module fills, derived rather than declared. */
|
|
524
|
+
export function engineCapabilitiesFilledByProviderModule(provider) {
|
|
525
|
+
return [...new Set(engineSlotsBoundByCapabilities(provider.providerCapabilities).map((entry) => entry.slot))];
|
|
526
|
+
}
|
|
527
|
+
/** The file a module's manifest lives in: at the root of every artifact, of a checkout module, and of a publishing application. */
|
|
528
|
+
export const MODULE_MANIFEST_FILE_NAME = 'wildo.module.json';
|
|
125
529
|
/**
|
|
126
530
|
* Top-level manifest. Stored at `wildo.module.json` inside every
|
|
127
531
|
* artifact zip and at the registry server alongside its version row.
|
|
@@ -131,19 +535,63 @@ export const ModuleManifestBoundariesSchema = z.strictObject({
|
|
|
131
535
|
* (`sections.modules.installed[<id>]`).
|
|
132
536
|
*/
|
|
133
537
|
export const ModuleManifestSchema = z.object({
|
|
134
|
-
id:
|
|
538
|
+
id: ModuleIdSchema,
|
|
135
539
|
version: SemverExact,
|
|
540
|
+
/** What the module is. Absent reads as FEATURE: every module published before #2014 is one. */
|
|
541
|
+
kind: z.enum(ModuleKind).default(ModuleKind.FEATURE),
|
|
542
|
+
/** Present exactly when `kind` is PROVIDER. */
|
|
543
|
+
provider: ModuleManifestProviderSchema.optional(),
|
|
136
544
|
description: z.string().optional(),
|
|
137
545
|
/** Free-form description of what the module ships, for `wildo registry info`. */
|
|
138
546
|
longDescription: z.string().optional(),
|
|
139
547
|
engine: ModuleManifestEngineSchema.optional(),
|
|
140
548
|
boundaries: ModuleManifestBoundariesSchema.optional(),
|
|
141
549
|
dependsOn: ModuleManifestDependenciesSchema.optional(),
|
|
550
|
+
/** How the module is registered in a host application — see {@link ModuleManifestRegistrationSchema}. */
|
|
551
|
+
registration: ModuleManifestRegistrationSchema.optional(),
|
|
142
552
|
/**
|
|
143
553
|
* Free-form key/value bag for non-load-bearing metadata
|
|
144
554
|
* (homepage, license, repository). Phase 1 keeps it open;
|
|
145
555
|
* Phase 6 may tighten it for `wildo registry publish` UX.
|
|
146
556
|
*/
|
|
147
557
|
meta: z.record(z.string().min(1), z.unknown()).optional(),
|
|
148
|
-
}).catchall(z.unknown())
|
|
558
|
+
}).catchall(z.unknown()).superRefine((manifest, context) => {
|
|
559
|
+
const providerBoundaries = manifest.boundaries?.providers ?? [];
|
|
560
|
+
if (manifest.kind !== ModuleKind.PROVIDER) {
|
|
561
|
+
if (manifest.provider !== undefined) {
|
|
562
|
+
context.addIssue({ code: 'custom', path: ['provider'], message: 'only a module of kind `provider` carries a provider block' });
|
|
563
|
+
}
|
|
564
|
+
if (providerBoundaries.length > 0) {
|
|
565
|
+
context.addIssue({ code: 'custom', path: ['boundaries', 'providers'], message: 'only a module of kind `provider` writes below `providers/`' });
|
|
566
|
+
}
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (manifest.provider === undefined) {
|
|
570
|
+
context.addIssue({ code: 'custom', path: ['provider'], message: 'a module of kind `provider` carries a provider block' });
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
// A provider's owners are the INSTALLING application's, so the installer derives its wiring (#2014). A manifest
|
|
574
|
+
// that carried one would be telling an installer which of its files to edit.
|
|
575
|
+
if (manifest.registration !== undefined) {
|
|
576
|
+
context.addIssue({ code: 'custom', path: ['registration'], message: 'a provider module carries no registration: each installing application derives its own wiring' });
|
|
577
|
+
}
|
|
578
|
+
// A provider module IS one package directory: exactly `providers/<ref>`, and nothing in any other layer,
|
|
579
|
+
// so installing it can never write into the application's own modules, minions or workers.
|
|
580
|
+
const expected = `${MODULE_BOUNDARY_LAYER_ROOTS.providers}/${manifest.provider.ref}`;
|
|
581
|
+
if (providerBoundaries.length !== 1 || providerBoundaries[0] !== expected) {
|
|
582
|
+
context.addIssue({
|
|
583
|
+
code: 'custom',
|
|
584
|
+
path: ['boundaries', 'providers'],
|
|
585
|
+
message: `a provider module's boundaries are exactly [\`${expected}\`] (found ${JSON.stringify(providerBoundaries)})`,
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
const otherLayers = MODULE_BOUNDARY_LAYERS.filter((layer) => layer !== 'providers' && (manifest.boundaries?.[layer] ?? []).length > 0);
|
|
589
|
+
if (otherLayers.length > 0) {
|
|
590
|
+
context.addIssue({
|
|
591
|
+
code: 'custom',
|
|
592
|
+
path: ['boundaries'],
|
|
593
|
+
message: `a provider module writes only below \`providers/\`, but it also declares ${otherLayers.join(', ')}`,
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
});
|
|
149
597
|
//# sourceMappingURL=module-manifest.schemas.js.map
|