@vizejs/marquette 0.815.0 → 0.816.0
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/README.md +182 -70
- package/dist/adapter-capability-manifest.schema.json +2 -2
- package/dist/adapter.d.mts +4 -4
- package/dist/adapter.d.mts.map +1 -1
- package/dist/adapter.mjs +11 -6
- package/dist/adapter.mjs.map +1 -1
- package/dist/application-contract.schema.json +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{model-B_mM8AeH.d.mts → model-BcXukmxj.d.mts} +2 -2
- package/dist/{model-B_mM8AeH.d.mts.map → model-BcXukmxj.d.mts.map} +1 -1
- package/dist/native-build-admission.d.mts +381 -0
- package/dist/native-build-admission.d.mts.map +1 -0
- package/dist/native-build-admission.mjs +505 -0
- package/dist/native-build-admission.mjs.map +1 -0
- package/dist/native-build.d.mts +28 -1
- package/dist/native-build.d.mts.map +1 -1
- package/dist/native-build.mjs +11 -1
- package/dist/native-build.mjs.map +1 -1
- package/dist/navigation-links.d.mts +1 -1
- package/dist/navigation.d.mts +1 -1
- package/dist/validate.d.mts +1 -1
- package/dist/validate.mjs +2 -2
- package/dist/validate.mjs.map +1 -1
- package/package.json +6 -1
- package/scripts/package-tasks.cjs +6 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
//#region src/adapter-validate.ts
|
|
2
|
+
const IDENTIFIER$2 = /^[a-z0-9][a-z0-9._-]*$/;
|
|
3
|
+
const DIAGNOSTIC_ORDER$1 = {
|
|
4
|
+
"invalid-format-version": 0,
|
|
5
|
+
"invalid-adapter-id": 1,
|
|
6
|
+
"invalid-capability-id": 2,
|
|
7
|
+
"invalid-version": 3,
|
|
8
|
+
"invalid-version-range": 4,
|
|
9
|
+
"duplicate-capability": 5
|
|
10
|
+
};
|
|
11
|
+
/** Validates an adapter capability manifest without mutating it. */
|
|
12
|
+
function validateAdapterCapabilityManifest(manifest) {
|
|
13
|
+
const diagnostics = [];
|
|
14
|
+
if ((manifest.formatVersion ?? 1) !== 1) diagnostics.push(diagnostic$1("invalid-format-version", "formatVersion", "unsupported adapter capability manifest format version"));
|
|
15
|
+
if (!IDENTIFIER$2.test(manifest.adapter)) diagnostics.push(diagnostic$1("invalid-adapter-id", "adapter", "adapter must be a lowercase portable identifier"));
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
for (const [index, capability] of (manifest.capabilities ?? []).entries()) {
|
|
18
|
+
const path = `capabilities.${index}`;
|
|
19
|
+
if (!IDENTIFIER$2.test(capability.id)) diagnostics.push(diagnostic$1("invalid-capability-id", `${path}.id`, "capability id must be a lowercase portable identifier"));
|
|
20
|
+
if (seen.has(capability.id)) diagnostics.push(diagnostic$1("duplicate-capability", `${path}.id`, "capability id must be unique within the adapter manifest"));
|
|
21
|
+
seen.add(capability.id);
|
|
22
|
+
if (!Number.isInteger(capability.minVersion) || capability.minVersion < 0 || capability.minVersion > 4294967295) diagnostics.push(diagnostic$1("invalid-version", `${path}.minVersion`, "minimum supported version must be an unsigned 32-bit integer"));
|
|
23
|
+
else if (capability.minVersion === 0) diagnostics.push(diagnostic$1("invalid-version", `${path}.minVersion`, "minimum supported version must be greater than zero"));
|
|
24
|
+
if (!Number.isInteger(capability.maxVersion) || capability.maxVersion < 0 || capability.maxVersion > 4294967295) diagnostics.push(diagnostic$1("invalid-version", `${path}.maxVersion`, "maximum supported version must be an unsigned 32-bit integer"));
|
|
25
|
+
else if (capability.maxVersion === 0) diagnostics.push(diagnostic$1("invalid-version", `${path}.maxVersion`, "maximum supported version must be greater than zero"));
|
|
26
|
+
if (capability.minVersion > capability.maxVersion) diagnostics.push(diagnostic$1("invalid-version-range", path, "minimum supported version must not exceed maximum supported version"));
|
|
27
|
+
}
|
|
28
|
+
return diagnostics.sort((left, right) => compareText$3(left.path, right.path) || DIAGNOSTIC_ORDER$1[left.code] - DIAGNOSTIC_ORDER$1[right.code] || compareText$3(left.message, right.message));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parses an untrusted manifest with strict field and primitive checks.
|
|
32
|
+
*
|
|
33
|
+
* Unknown fields, missing required fields, and mismatched primitive types
|
|
34
|
+
* throw before negotiation. Semantic range errors remain available from
|
|
35
|
+
* {@link validateAdapterCapabilityManifest}.
|
|
36
|
+
*/
|
|
37
|
+
function parseAdapterCapabilityManifest(value) {
|
|
38
|
+
assertRecord$1(value, "manifest");
|
|
39
|
+
assertKnownFields$1(value, [
|
|
40
|
+
"formatVersion",
|
|
41
|
+
"adapter",
|
|
42
|
+
"capabilities"
|
|
43
|
+
], "manifest");
|
|
44
|
+
if (value.formatVersion !== void 0 && typeof value.formatVersion !== "number") throw new TypeError("formatVersion must be a number");
|
|
45
|
+
if (typeof value.adapter !== "string") throw new TypeError("adapter must be a string");
|
|
46
|
+
if (value.capabilities !== void 0) {
|
|
47
|
+
if (!Array.isArray(value.capabilities)) throw new TypeError("capabilities must be an array");
|
|
48
|
+
for (const [index, capability] of value.capabilities.entries()) {
|
|
49
|
+
const path = `capabilities.${index}`;
|
|
50
|
+
assertRecord$1(capability, path);
|
|
51
|
+
assertKnownFields$1(capability, [
|
|
52
|
+
"id",
|
|
53
|
+
"minVersion",
|
|
54
|
+
"maxVersion"
|
|
55
|
+
], path);
|
|
56
|
+
if (typeof capability.id !== "string") throw new TypeError(`${path}.id must be a string`);
|
|
57
|
+
if (typeof capability.minVersion !== "number" || !Number.isSafeInteger(capability.minVersion) || capability.minVersion < 0 || capability.minVersion > 4294967295) throw new TypeError(`${path}.minVersion must be a safe integer in the unsigned 32-bit range`);
|
|
58
|
+
if (typeof capability.maxVersion !== "number" || !Number.isSafeInteger(capability.maxVersion) || capability.maxVersion < 0 || capability.maxVersion > 4294967295) throw new TypeError(`${path}.maxVersion must be a safe integer in the unsigned 32-bit range`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
function diagnostic$1(code, path, message) {
|
|
64
|
+
return {
|
|
65
|
+
code,
|
|
66
|
+
path,
|
|
67
|
+
message
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function assertRecord$1(value, path) {
|
|
71
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) throw new TypeError(`${path} must be an object`);
|
|
72
|
+
}
|
|
73
|
+
function assertKnownFields$1(value, expected, path) {
|
|
74
|
+
const known = new Set(expected);
|
|
75
|
+
const unknown = Object.keys(value).find((field) => !known.has(field));
|
|
76
|
+
if (unknown !== void 0) throw new TypeError(`${path} has unknown field ${unknown}`);
|
|
77
|
+
}
|
|
78
|
+
function compareText$3(left, right) {
|
|
79
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/adapter-negotiate.ts
|
|
83
|
+
/**
|
|
84
|
+
* Negotiates application capability requirements against one adapter.
|
|
85
|
+
*
|
|
86
|
+
* Requirement identifiers are deduplicated and sorted. Unknown application
|
|
87
|
+
* capability identifiers fail closed instead of being treated as adapter
|
|
88
|
+
* omissions. An invalid manifest never produces a compatible result.
|
|
89
|
+
*/
|
|
90
|
+
function negotiateAdapterCapabilities(marquette, requiredCapabilities, manifest) {
|
|
91
|
+
const diagnostics = validateAdapterCapabilityManifest(manifest);
|
|
92
|
+
const support = new Map((manifest.capabilities ?? []).map((capability) => [capability.id, capability]));
|
|
93
|
+
const mismatches = [...new Set(requiredCapabilities)].sort().flatMap((id) => mismatch(marquette, id, support.get(id), diagnostics.length === 0));
|
|
94
|
+
return {
|
|
95
|
+
adapter: manifest.adapter,
|
|
96
|
+
compatible: diagnostics.length === 0 && mismatches.length === 0,
|
|
97
|
+
diagnostics,
|
|
98
|
+
mismatches
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function mismatch(marquette, id, support, manifestIsValid) {
|
|
102
|
+
const declarations = marquette.capabilities;
|
|
103
|
+
const requirement = declarations && Object.hasOwn(declarations, id) ? declarations[id] : void 0;
|
|
104
|
+
if (requirement === void 0) return [problem("unknown-requirement", id)];
|
|
105
|
+
const requiredVersion = requirement.version === void 0 ? 1 : requirement.version;
|
|
106
|
+
if (!Number.isInteger(requiredVersion) || requiredVersion < 1 || requiredVersion > 4294967295) return [problem("invalid-requirement-version", id)];
|
|
107
|
+
if (!manifestIsValid) return [];
|
|
108
|
+
if (support === void 0) return [problem("missing-capability", id, requiredVersion)];
|
|
109
|
+
if (requiredVersion < support.minVersion) return [problem("version-below-minimum", id, requiredVersion, support)];
|
|
110
|
+
if (requiredVersion > support.maxVersion) return [problem("version-above-maximum", id, requiredVersion, support)];
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
function problem(code, capability, requiredVersion, support) {
|
|
114
|
+
return {
|
|
115
|
+
code,
|
|
116
|
+
capability,
|
|
117
|
+
path: `capabilities.${capability}`,
|
|
118
|
+
message: mismatchMessage(code),
|
|
119
|
+
...requiredVersion === void 0 ? {} : { requiredVersion },
|
|
120
|
+
...support === void 0 ? {} : {
|
|
121
|
+
minVersion: support.minVersion,
|
|
122
|
+
maxVersion: support.maxVersion
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function mismatchMessage(code) {
|
|
127
|
+
switch (code) {
|
|
128
|
+
case "unknown-requirement": return "application references an undeclared capability requirement";
|
|
129
|
+
case "invalid-requirement-version": return "application capability version must be a positive unsigned 32-bit integer";
|
|
130
|
+
case "missing-capability": return "adapter does not support the required capability";
|
|
131
|
+
case "version-below-minimum": return "application requires a capability version below the adapter minimum";
|
|
132
|
+
case "version-above-maximum": return "application requires a capability version above the adapter maximum";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/native-build-validate.ts
|
|
137
|
+
const IDENTIFIER$1 = /^[a-z0-9][a-z0-9._-]*$/;
|
|
138
|
+
const RUNTIME_VERSION = /^[0-9A-Za-z][0-9A-Za-z._+-]*$/;
|
|
139
|
+
const CONFIGURATIONS = new Set([
|
|
140
|
+
"development",
|
|
141
|
+
"preview",
|
|
142
|
+
"production"
|
|
143
|
+
]);
|
|
144
|
+
const PLATFORMS = new Set(["android", "ios"]);
|
|
145
|
+
const DESTINATIONS = new Set([
|
|
146
|
+
"simulator",
|
|
147
|
+
"device",
|
|
148
|
+
"store"
|
|
149
|
+
]);
|
|
150
|
+
const SIGNING_MODES = new Set([
|
|
151
|
+
"none",
|
|
152
|
+
"automatic",
|
|
153
|
+
"manual"
|
|
154
|
+
]);
|
|
155
|
+
const DIAGNOSTIC_ORDER = {
|
|
156
|
+
"invalid-format": 0,
|
|
157
|
+
"invalid-format-version": 1,
|
|
158
|
+
"invalid-profile-id": 2,
|
|
159
|
+
"invalid-environment-id": 3,
|
|
160
|
+
"missing-target": 4,
|
|
161
|
+
"duplicate-target": 5,
|
|
162
|
+
"store-requires-production": 6,
|
|
163
|
+
"store-requires-signing": 7,
|
|
164
|
+
"invalid-update-channel": 8,
|
|
165
|
+
"invalid-runtime-version": 9,
|
|
166
|
+
"invalid-capability-id": 10,
|
|
167
|
+
"duplicate-capability": 11
|
|
168
|
+
};
|
|
169
|
+
/** Validates a native build profile without mutating it. */
|
|
170
|
+
function validateNativeBuildProfile(profile) {
|
|
171
|
+
const diagnostics = [];
|
|
172
|
+
if (profile.format !== "vize.native-build-profile") diagnostics.push(diagnostic("invalid-format", "format", "unsupported native build profile format"));
|
|
173
|
+
if (profile.formatVersion !== 1) diagnostics.push(diagnostic("invalid-format-version", "formatVersion", "unsupported native build profile format version"));
|
|
174
|
+
if (!IDENTIFIER$1.test(profile.profile)) diagnostics.push(diagnostic("invalid-profile-id", "profile", "profile must be a lowercase portable identifier"));
|
|
175
|
+
if (!IDENTIFIER$1.test(profile.environment)) diagnostics.push(diagnostic("invalid-environment-id", "environment", "environment must be a lowercase portable identifier"));
|
|
176
|
+
if (profile.targets.length === 0) diagnostics.push(diagnostic("missing-target", "targets", "native build profile must declare a target"));
|
|
177
|
+
const seenTargets = /* @__PURE__ */ new Set();
|
|
178
|
+
for (const [index, target] of profile.targets.entries()) {
|
|
179
|
+
const path = `targets.${index}`;
|
|
180
|
+
const key = `${target.platform}:${target.destination}`;
|
|
181
|
+
if (seenTargets.has(key)) diagnostics.push(diagnostic("duplicate-target", path, "platform and destination must be unique within the native build profile"));
|
|
182
|
+
seenTargets.add(key);
|
|
183
|
+
if (target.destination === "store" && profile.configuration !== "production") diagnostics.push(diagnostic("store-requires-production", path, "store targets require the production configuration"));
|
|
184
|
+
if (target.destination === "store" && (target.signing ?? "none") === "none") diagnostics.push(diagnostic("store-requires-signing", `${path}.signing`, "store targets require automatic or manual signing"));
|
|
185
|
+
}
|
|
186
|
+
if (profile.updates !== void 0) {
|
|
187
|
+
if (!IDENTIFIER$1.test(profile.updates.channel)) diagnostics.push(diagnostic("invalid-update-channel", "updates.channel", "update channel must be a lowercase portable identifier"));
|
|
188
|
+
if (!RUNTIME_VERSION.test(profile.updates.runtimeVersion)) diagnostics.push(diagnostic("invalid-runtime-version", "updates.runtimeVersion", "runtime version must be a portable non-empty version token"));
|
|
189
|
+
}
|
|
190
|
+
const seenCapabilities = /* @__PURE__ */ new Set();
|
|
191
|
+
for (const [index, capability] of (profile.capabilities ?? []).entries()) {
|
|
192
|
+
const path = `capabilities.${index}`;
|
|
193
|
+
if (!IDENTIFIER$1.test(capability)) diagnostics.push(diagnostic("invalid-capability-id", path, "capability id must be a lowercase portable identifier"));
|
|
194
|
+
if (seenCapabilities.has(capability)) diagnostics.push(diagnostic("duplicate-capability", path, "capability id must be unique within the native build profile"));
|
|
195
|
+
seenCapabilities.add(capability);
|
|
196
|
+
}
|
|
197
|
+
return diagnostics.sort((left, right) => compareText$2(left.path, right.path) || DIAGNOSTIC_ORDER[left.code] - DIAGNOSTIC_ORDER[right.code] || compareText$2(left.message, right.message));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Parses an untrusted native build profile with strict structural checks.
|
|
201
|
+
*
|
|
202
|
+
* Unknown fields and mismatched primitive or enum values throw before a local
|
|
203
|
+
* or hosted executor can inspect semantic diagnostics.
|
|
204
|
+
*/
|
|
205
|
+
function parseNativeBuildProfile(value) {
|
|
206
|
+
assertRecord(value, "profile");
|
|
207
|
+
assertKnownFields(value, [
|
|
208
|
+
"format",
|
|
209
|
+
"formatVersion",
|
|
210
|
+
"profile",
|
|
211
|
+
"configuration",
|
|
212
|
+
"environment",
|
|
213
|
+
"targets",
|
|
214
|
+
"capabilities",
|
|
215
|
+
"updates"
|
|
216
|
+
], "profile");
|
|
217
|
+
assertString(value.format, "format");
|
|
218
|
+
if (typeof value.formatVersion !== "number" || !Number.isSafeInteger(value.formatVersion) || value.formatVersion < 0) throw new TypeError("formatVersion must be a safe integer");
|
|
219
|
+
assertString(value.profile, "profile");
|
|
220
|
+
assertEnum(value.configuration, CONFIGURATIONS, "configuration");
|
|
221
|
+
assertString(value.environment, "environment");
|
|
222
|
+
if (!Array.isArray(value.targets)) throw new TypeError("targets must be an array");
|
|
223
|
+
for (const [index, target] of value.targets.entries()) {
|
|
224
|
+
const path = `targets.${index}`;
|
|
225
|
+
assertRecord(target, path);
|
|
226
|
+
assertKnownFields(target, [
|
|
227
|
+
"platform",
|
|
228
|
+
"destination",
|
|
229
|
+
"signing"
|
|
230
|
+
], path);
|
|
231
|
+
assertEnum(target.platform, PLATFORMS, `${path}.platform`);
|
|
232
|
+
assertEnum(target.destination, DESTINATIONS, `${path}.destination`);
|
|
233
|
+
if (target.signing !== void 0) assertEnum(target.signing, SIGNING_MODES, `${path}.signing`);
|
|
234
|
+
}
|
|
235
|
+
if (value.capabilities !== void 0) {
|
|
236
|
+
if (!Array.isArray(value.capabilities)) throw new TypeError("capabilities must be an array");
|
|
237
|
+
for (const [index, capability] of value.capabilities.entries()) assertString(capability, `capabilities.${index}`);
|
|
238
|
+
}
|
|
239
|
+
if (value.updates !== void 0) {
|
|
240
|
+
assertRecord(value.updates, "updates");
|
|
241
|
+
assertKnownFields(value.updates, ["channel", "runtimeVersion"], "updates");
|
|
242
|
+
assertString(value.updates.channel, "updates.channel");
|
|
243
|
+
assertString(value.updates.runtimeVersion, "updates.runtimeVersion");
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
function diagnostic(code, path, message) {
|
|
248
|
+
return {
|
|
249
|
+
code,
|
|
250
|
+
path,
|
|
251
|
+
message
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function assertRecord(value, path) {
|
|
255
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) throw new TypeError(`${path} must be an object`);
|
|
256
|
+
}
|
|
257
|
+
function assertKnownFields(value, expected, path) {
|
|
258
|
+
const known = new Set(expected);
|
|
259
|
+
const unknown = Object.keys(value).find((field) => !known.has(field));
|
|
260
|
+
if (unknown !== void 0) throw new TypeError(`${path} has unknown field ${unknown}`);
|
|
261
|
+
}
|
|
262
|
+
function assertString(value, path) {
|
|
263
|
+
if (typeof value !== "string") throw new TypeError(`${path} must be a string`);
|
|
264
|
+
}
|
|
265
|
+
function assertEnum(value, expected, path) {
|
|
266
|
+
if (typeof value !== "string" || !expected.has(value)) throw new TypeError(`${path} must be a supported string value`);
|
|
267
|
+
}
|
|
268
|
+
function compareText$2(left, right) {
|
|
269
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/validate.ts
|
|
273
|
+
const IDENTIFIER = /^[a-z0-9][a-z0-9._-]*$/;
|
|
274
|
+
const SUPPORTED_FORMAT_VERSION = 1;
|
|
275
|
+
/**
|
|
276
|
+
* Validates a complete application marquette.
|
|
277
|
+
*
|
|
278
|
+
* Diagnostics cover structural, reference, capability, target, and dependency
|
|
279
|
+
* invariants. Results are sorted by path, code, and message so identical input
|
|
280
|
+
* produces stable editor, CLI, test, and CI output.
|
|
281
|
+
*
|
|
282
|
+
* This function does not mutate the authored object and does not throw.
|
|
283
|
+
*/
|
|
284
|
+
function validateApplicationMarquette(marquette) {
|
|
285
|
+
const diagnostics = [];
|
|
286
|
+
const environments = marquette.environments ?? [];
|
|
287
|
+
const backends = marquette.backends ?? [];
|
|
288
|
+
const protocols = marquette.protocols ?? [];
|
|
289
|
+
const routes = marquette.routes ?? [];
|
|
290
|
+
const targets = new Set(marquette.targets ?? []);
|
|
291
|
+
const capabilityIds = new Set(Object.keys(marquette.capabilities ?? {}));
|
|
292
|
+
if ((marquette.formatVersion ?? SUPPORTED_FORMAT_VERSION) !== SUPPORTED_FORMAT_VERSION) diagnostics.push(error("VIZE_MARQUETTE_001", "formatVersion", "unsupported marquette format version"));
|
|
293
|
+
validateIdentifier(marquette.application, "application", "VIZE_MARQUETTE_002", diagnostics);
|
|
294
|
+
for (const [key, capability] of Object.entries(marquette.capabilities ?? {})) {
|
|
295
|
+
const path = contractPath("capabilities", key);
|
|
296
|
+
validateIdentifier(key, path, "VIZE_MARQUETTE_003", diagnostics);
|
|
297
|
+
if (key !== capability.id) diagnostics.push(error("VIZE_MARQUETTE_004", path, "capability map key must equal capability.id"));
|
|
298
|
+
const version = capability.version === void 0 ? 1 : capability.version;
|
|
299
|
+
if (!Number.isInteger(version) || version < 1 || version > 4294967295) diagnostics.push(error("VIZE_MARQUETTE_005", path, version === 0 ? "capability version must be greater than zero" : "capability version must be a positive unsigned 32-bit integer"));
|
|
300
|
+
if (capability.description.trim().length === 0) diagnostics.push(error("VIZE_MARQUETTE_024", path, "capability description must not be empty"));
|
|
301
|
+
}
|
|
302
|
+
const environmentIds = collectUniqueIds("environments", environments, diagnostics);
|
|
303
|
+
const backendIds = collectUniqueIds("backends", backends, diagnostics);
|
|
304
|
+
const protocolIds = collectUniqueIds("protocols", protocols, diagnostics);
|
|
305
|
+
collectUniqueIds("routes", routes, diagnostics);
|
|
306
|
+
for (const environment of environments) {
|
|
307
|
+
const path = contractPath("environments", environment.id);
|
|
308
|
+
if (!targets.has(environment.target)) diagnostics.push(error("VIZE_MARQUETTE_007", path, "environment target must be declared in targets"));
|
|
309
|
+
for (const dependency of [...new Set(environment.dependsOn ?? [])].sort()) if (dependency === environment.id) diagnostics.push(error("VIZE_MARQUETTE_008", path, "environment cannot depend on itself"));
|
|
310
|
+
else if (!environmentIds.has(dependency)) diagnostics.push(error("VIZE_MARQUETTE_009", path, "environment dependency does not exist"));
|
|
311
|
+
validateCapabilities(path, environment.capabilities, capabilityIds, diagnostics);
|
|
312
|
+
if (environment.consumer === "client" && (environment.runtime === "rust" || environment.runtime === "go" || environment.runtime === "jvm")) diagnostics.push(warning("VIZE_MARQUETTE_010", path, "client environment uses a server-oriented runtime; declare an adapter capability if this is intentional"));
|
|
313
|
+
}
|
|
314
|
+
validateEnvironmentCycles(environments, diagnostics);
|
|
315
|
+
for (const backend of backends) {
|
|
316
|
+
const path = contractPath("backends", backend.id);
|
|
317
|
+
if (backend.environment != null) {
|
|
318
|
+
const environment = environments.find((candidate) => candidate.id === backend.environment);
|
|
319
|
+
if (environment == null) diagnostics.push(error("VIZE_MARQUETTE_011", path, "backend environment does not exist"));
|
|
320
|
+
else if (environment.consumer !== "server") diagnostics.push(error("VIZE_MARQUETTE_012", path, "backend environment must be a server consumer"));
|
|
321
|
+
}
|
|
322
|
+
validateCapabilities(path, backend.capabilities, capabilityIds, diagnostics);
|
|
323
|
+
}
|
|
324
|
+
for (const protocol of protocols) {
|
|
325
|
+
const path = contractPath("protocols", protocol.id);
|
|
326
|
+
if (!backendIds.has(protocol.backend)) diagnostics.push(error("VIZE_MARQUETTE_013", path, "protocol backend does not exist"));
|
|
327
|
+
validateCapabilities(path, protocol.capabilities, capabilityIds, diagnostics);
|
|
328
|
+
}
|
|
329
|
+
const routePaths = /* @__PURE__ */ new Map();
|
|
330
|
+
for (const route of routes) {
|
|
331
|
+
const path = contractPath("routes", route.id);
|
|
332
|
+
if (!route.path.startsWith("/")) diagnostics.push(error("VIZE_MARQUETTE_014", path, "route path must start with /"));
|
|
333
|
+
const environment = environments.find((candidate) => candidate.id === route.environment);
|
|
334
|
+
if (environment == null) diagnostics.push(error("VIZE_MARQUETTE_015", path, "route environment does not exist"));
|
|
335
|
+
if (route.backend != null && !backendIds.has(route.backend)) diagnostics.push(error("VIZE_MARQUETTE_016", path, "route backend does not exist"));
|
|
336
|
+
if (route.protocol != null) {
|
|
337
|
+
const protocol = protocols.find((candidate) => candidate.id === route.protocol);
|
|
338
|
+
if (!protocolIds.has(route.protocol) || protocol == null) diagnostics.push(error("VIZE_MARQUETTE_017", path, "route protocol does not exist"));
|
|
339
|
+
else if (route.backend != null && protocol.backend !== route.backend) diagnostics.push(error("VIZE_MARQUETTE_018", path, "route protocol and backend must refer to the same service"));
|
|
340
|
+
}
|
|
341
|
+
if (environment != null && !renderingMatchesTarget(route, environment.target)) diagnostics.push(error("VIZE_MARQUETTE_023", path, "rendering mode is not compatible with the route environment target"));
|
|
342
|
+
validateCapabilities(path, route.capabilities, capabilityIds, diagnostics);
|
|
343
|
+
const routeKey = `${route.environment}\u0000${route.path}`;
|
|
344
|
+
const previous = routePaths.get(routeKey);
|
|
345
|
+
if (previous != null) diagnostics.push(error("VIZE_MARQUETTE_019", path, `route path is already used by route "${previous}"`));
|
|
346
|
+
routePaths.set(routeKey, route.id);
|
|
347
|
+
}
|
|
348
|
+
for (const target of targets) if (!environments.some((environment) => environment.target === target)) diagnostics.push(warning("VIZE_MARQUETTE_020", "targets", "declared target has no environment"));
|
|
349
|
+
return diagnostics.sort(compareDiagnostics);
|
|
350
|
+
}
|
|
351
|
+
function collectUniqueIds(collection, values, diagnostics) {
|
|
352
|
+
const ids = /* @__PURE__ */ new Set();
|
|
353
|
+
for (const value of values) {
|
|
354
|
+
const path = contractPath(collection, value.id);
|
|
355
|
+
validateIdentifier(value.id, path, "VIZE_MARQUETTE_006", diagnostics);
|
|
356
|
+
if (ids.has(value.id)) diagnostics.push(error("VIZE_MARQUETTE_006", path, "identifier must be unique within its collection"));
|
|
357
|
+
ids.add(value.id);
|
|
358
|
+
}
|
|
359
|
+
return ids;
|
|
360
|
+
}
|
|
361
|
+
function validateIdentifier(id, path, code, diagnostics) {
|
|
362
|
+
if (!IDENTIFIER.test(id)) diagnostics.push(error(code, path, "identifier must use lowercase ASCII letters, digits, dash, underscore, or dot"));
|
|
363
|
+
}
|
|
364
|
+
function validateCapabilities(path, capabilities, declared, diagnostics) {
|
|
365
|
+
for (const capability of [...new Set(capabilities ?? [])].sort()) if (!declared.has(capability)) diagnostics.push(error("VIZE_MARQUETTE_021", path, "referenced capability is not declared"));
|
|
366
|
+
}
|
|
367
|
+
function validateEnvironmentCycles(environments, diagnostics) {
|
|
368
|
+
const graph = new Map(environments.map((value) => [value.id, value.dependsOn ?? []]));
|
|
369
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
370
|
+
const visited = /* @__PURE__ */ new Set();
|
|
371
|
+
for (const id of [...graph.keys()].sort()) if (hasCycle(id, graph, visiting, visited)) diagnostics.push(error("VIZE_MARQUETTE_022", contractPath("environments", id), "environment dependency graph must be acyclic"));
|
|
372
|
+
}
|
|
373
|
+
function hasCycle(id, graph, visiting, visited) {
|
|
374
|
+
if (visited.has(id)) return false;
|
|
375
|
+
if (visiting.has(id)) return true;
|
|
376
|
+
visiting.add(id);
|
|
377
|
+
const cyclic = [...graph.get(id) ?? []].sort().some((dependency) => graph.has(dependency) && hasCycle(dependency, graph, visiting, visited));
|
|
378
|
+
visiting.delete(id);
|
|
379
|
+
visited.add(id);
|
|
380
|
+
return cyclic;
|
|
381
|
+
}
|
|
382
|
+
function renderingMatchesTarget(route, target) {
|
|
383
|
+
return ({
|
|
384
|
+
native: "native",
|
|
385
|
+
desktop: "desktop",
|
|
386
|
+
terminal: "terminal"
|
|
387
|
+
}[route.rendering] ?? "web") === target;
|
|
388
|
+
}
|
|
389
|
+
function compareDiagnostics(left, right) {
|
|
390
|
+
return compareText$1(left.path, right.path) || compareText$1(left.code, right.code) || compareText$1(left.message, right.message);
|
|
391
|
+
}
|
|
392
|
+
function compareText$1(left, right) {
|
|
393
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
394
|
+
}
|
|
395
|
+
function contractPath(collection, id) {
|
|
396
|
+
return `${collection}.${id}`;
|
|
397
|
+
}
|
|
398
|
+
function error(code, path, message) {
|
|
399
|
+
return {
|
|
400
|
+
code,
|
|
401
|
+
severity: "error",
|
|
402
|
+
path,
|
|
403
|
+
message
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function warning(code, path, message) {
|
|
407
|
+
return {
|
|
408
|
+
code,
|
|
409
|
+
severity: "warning",
|
|
410
|
+
path,
|
|
411
|
+
message
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/native-build-admission.ts
|
|
416
|
+
/**
|
|
417
|
+
* Binds a native build profile to an application and a concrete adapter manifest.
|
|
418
|
+
*
|
|
419
|
+
* Standalone profile validation cannot establish that the selected environment
|
|
420
|
+
* exists, is a native client, or that its routes can execute with the adapter.
|
|
421
|
+
* Admission checks all three contracts and negotiates the deduplicated union of
|
|
422
|
+
* profile, environment, and selected-route capabilities. Invalid application,
|
|
423
|
+
* profile, or adapter contracts and unsupported capability versions fail closed.
|
|
424
|
+
* Strict profile and adapter parsing runs first: malformed fields, unknown
|
|
425
|
+
* executor or secret fields, and unsafe numeric bounds throw `TypeError` before
|
|
426
|
+
* graph inspection. Semantically invalid contracts return `allowed: false`.
|
|
427
|
+
*
|
|
428
|
+
* This experimental synchronous decision neither schedules a build nor handles
|
|
429
|
+
* secrets. Executors must inspect `allowed` immediately before scheduling, using
|
|
430
|
+
* the same inputs they pass to the build. Application warnings remain visible
|
|
431
|
+
* without becoming errors. Inputs are not mutated; cost is linear in contract
|
|
432
|
+
* collections plus sorting their diagnostics and required capability identifiers.
|
|
433
|
+
*/
|
|
434
|
+
function admitNativeBuildProfile(marquette, profile, adapter) {
|
|
435
|
+
parseNativeBuildProfile(profile);
|
|
436
|
+
parseAdapterCapabilityManifest(adapter);
|
|
437
|
+
const environment = marquette.environments?.find(({ id }) => id === profile.environment);
|
|
438
|
+
const capabilities = [...new Set([
|
|
439
|
+
...profile.capabilities ?? [],
|
|
440
|
+
...environment?.capabilities ?? [],
|
|
441
|
+
...(marquette.routes ?? []).filter((route) => route.environment === profile.environment).flatMap((route) => route.capabilities ?? [])
|
|
442
|
+
])].sort();
|
|
443
|
+
const negotiation = negotiateAdapterCapabilities(marquette, capabilities, adapter);
|
|
444
|
+
const diagnostics = [
|
|
445
|
+
...validateApplicationMarquette(marquette).map((diagnostic) => ({
|
|
446
|
+
...diagnostic,
|
|
447
|
+
source: "application"
|
|
448
|
+
})),
|
|
449
|
+
...validateNativeBuildProfile(profile).map((diagnostic) => ({
|
|
450
|
+
...diagnostic,
|
|
451
|
+
source: "profile",
|
|
452
|
+
severity: "error"
|
|
453
|
+
})),
|
|
454
|
+
...bindingDiagnostics(environment, profile.environment).map((diagnostic) => ({
|
|
455
|
+
...diagnostic,
|
|
456
|
+
source: "binding",
|
|
457
|
+
severity: "error"
|
|
458
|
+
})),
|
|
459
|
+
...negotiation.diagnostics.map((diagnostic) => ({
|
|
460
|
+
...diagnostic,
|
|
461
|
+
source: "adapter",
|
|
462
|
+
severity: "error"
|
|
463
|
+
})),
|
|
464
|
+
...negotiation.mismatches.map((diagnostic) => ({
|
|
465
|
+
...diagnostic,
|
|
466
|
+
source: "capability",
|
|
467
|
+
severity: "error"
|
|
468
|
+
}))
|
|
469
|
+
];
|
|
470
|
+
diagnostics.sort((left, right) => compareText(left.source, right.source) || compareText(left.path, right.path) || compareText(left.code, right.code) || compareText(left.message, right.message));
|
|
471
|
+
return {
|
|
472
|
+
allowed: negotiation.compatible && !diagnostics.some(({ severity }) => severity === "error"),
|
|
473
|
+
profile: profile.profile,
|
|
474
|
+
environment: profile.environment,
|
|
475
|
+
adapter: adapter.adapter,
|
|
476
|
+
capabilities,
|
|
477
|
+
diagnostics
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function bindingDiagnostics(environment, id) {
|
|
481
|
+
if (environment === void 0) return [{
|
|
482
|
+
code: "unknown-environment",
|
|
483
|
+
path: "environment",
|
|
484
|
+
message: "native build environment is not declared by the application"
|
|
485
|
+
}];
|
|
486
|
+
const diagnostics = [];
|
|
487
|
+
if (environment.target !== "native") diagnostics.push({
|
|
488
|
+
code: "environment-not-native",
|
|
489
|
+
path: `environments.${id}.target`,
|
|
490
|
+
message: "native builds require an environment with the native target"
|
|
491
|
+
});
|
|
492
|
+
if (environment.consumer !== "client") diagnostics.push({
|
|
493
|
+
code: "environment-not-client",
|
|
494
|
+
path: `environments.${id}.consumer`,
|
|
495
|
+
message: "native builds require a client environment"
|
|
496
|
+
});
|
|
497
|
+
return diagnostics;
|
|
498
|
+
}
|
|
499
|
+
function compareText(left, right) {
|
|
500
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
export { admitNativeBuildProfile };
|
|
504
|
+
|
|
505
|
+
//# sourceMappingURL=native-build-admission.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-build-admission.mjs","names":["IDENTIFIER","DIAGNOSTIC_ORDER","diagnostic","compareText","assertRecord","assertKnownFields","IDENTIFIER","compareText","compareText"],"sources":["../src/adapter-validate.ts","../src/adapter-negotiate.ts","../src/native-build-model.ts","../src/native-build-validate.ts","../src/validate.ts","../src/native-build-admission.ts"],"sourcesContent":["import {\n ADAPTER_CAPABILITY_FORMAT_VERSION,\n type AdapterCapabilityDiagnostic,\n type AdapterCapabilityDiagnosticCode,\n type AdapterCapabilityManifest,\n} from \"./adapter-model.js\";\n\nconst IDENTIFIER = /^[a-z0-9][a-z0-9._-]*$/;\nconst DIAGNOSTIC_ORDER: Record<AdapterCapabilityDiagnosticCode, number> = {\n \"invalid-format-version\": 0,\n \"invalid-adapter-id\": 1,\n \"invalid-capability-id\": 2,\n \"invalid-version\": 3,\n \"invalid-version-range\": 4,\n \"duplicate-capability\": 5,\n};\n\n/** Validates an adapter capability manifest without mutating it. */\nexport function validateAdapterCapabilityManifest(\n manifest: AdapterCapabilityManifest,\n): AdapterCapabilityDiagnostic[] {\n const diagnostics: AdapterCapabilityDiagnostic[] = [];\n if ((manifest.formatVersion ?? 1) !== ADAPTER_CAPABILITY_FORMAT_VERSION) {\n diagnostics.push(\n diagnostic(\n \"invalid-format-version\",\n \"formatVersion\",\n \"unsupported adapter capability manifest format version\",\n ),\n );\n }\n if (!IDENTIFIER.test(manifest.adapter)) {\n diagnostics.push(\n diagnostic(\n \"invalid-adapter-id\",\n \"adapter\",\n \"adapter must be a lowercase portable identifier\",\n ),\n );\n }\n\n const seen = new Set<string>();\n for (const [index, capability] of (manifest.capabilities ?? []).entries()) {\n const path = `capabilities.${index}`;\n if (!IDENTIFIER.test(capability.id)) {\n diagnostics.push(\n diagnostic(\n \"invalid-capability-id\",\n `${path}.id`,\n \"capability id must be a lowercase portable identifier\",\n ),\n );\n }\n if (seen.has(capability.id)) {\n diagnostics.push(\n diagnostic(\n \"duplicate-capability\",\n `${path}.id`,\n \"capability id must be unique within the adapter manifest\",\n ),\n );\n }\n seen.add(capability.id);\n if (\n !Number.isInteger(capability.minVersion) ||\n capability.minVersion < 0 ||\n capability.minVersion > 0xffff_ffff\n ) {\n diagnostics.push(\n diagnostic(\n \"invalid-version\",\n `${path}.minVersion`,\n \"minimum supported version must be an unsigned 32-bit integer\",\n ),\n );\n } else if (capability.minVersion === 0) {\n diagnostics.push(\n diagnostic(\n \"invalid-version\",\n `${path}.minVersion`,\n \"minimum supported version must be greater than zero\",\n ),\n );\n }\n if (\n !Number.isInteger(capability.maxVersion) ||\n capability.maxVersion < 0 ||\n capability.maxVersion > 0xffff_ffff\n ) {\n diagnostics.push(\n diagnostic(\n \"invalid-version\",\n `${path}.maxVersion`,\n \"maximum supported version must be an unsigned 32-bit integer\",\n ),\n );\n } else if (capability.maxVersion === 0) {\n diagnostics.push(\n diagnostic(\n \"invalid-version\",\n `${path}.maxVersion`,\n \"maximum supported version must be greater than zero\",\n ),\n );\n }\n if (capability.minVersion > capability.maxVersion) {\n diagnostics.push(\n diagnostic(\n \"invalid-version-range\",\n path,\n \"minimum supported version must not exceed maximum supported version\",\n ),\n );\n }\n }\n\n return diagnostics.sort(\n (left, right) =>\n compareText(left.path, right.path) ||\n DIAGNOSTIC_ORDER[left.code] - DIAGNOSTIC_ORDER[right.code] ||\n compareText(left.message, right.message),\n );\n}\n\n/**\n * Parses an untrusted manifest with strict field and primitive checks.\n *\n * Unknown fields, missing required fields, and mismatched primitive types\n * throw before negotiation. Semantic range errors remain available from\n * {@link validateAdapterCapabilityManifest}.\n */\nexport function parseAdapterCapabilityManifest(value: unknown): AdapterCapabilityManifest {\n assertRecord(value, \"manifest\");\n assertKnownFields(value, [\"formatVersion\", \"adapter\", \"capabilities\"], \"manifest\");\n if (value.formatVersion !== undefined && typeof value.formatVersion !== \"number\") {\n throw new TypeError(\"formatVersion must be a number\");\n }\n if (typeof value.adapter !== \"string\") {\n throw new TypeError(\"adapter must be a string\");\n }\n if (value.capabilities !== undefined) {\n if (!Array.isArray(value.capabilities)) {\n throw new TypeError(\"capabilities must be an array\");\n }\n for (const [index, capability] of value.capabilities.entries()) {\n const path = `capabilities.${index}`;\n assertRecord(capability, path);\n assertKnownFields(capability, [\"id\", \"minVersion\", \"maxVersion\"], path);\n if (typeof capability.id !== \"string\") throw new TypeError(`${path}.id must be a string`);\n if (\n typeof capability.minVersion !== \"number\" ||\n !Number.isSafeInteger(capability.minVersion) ||\n capability.minVersion < 0 ||\n capability.minVersion > 0xffff_ffff\n ) {\n throw new TypeError(\n `${path}.minVersion must be a safe integer in the unsigned 32-bit range`,\n );\n }\n if (\n typeof capability.maxVersion !== \"number\" ||\n !Number.isSafeInteger(capability.maxVersion) ||\n capability.maxVersion < 0 ||\n capability.maxVersion > 0xffff_ffff\n ) {\n throw new TypeError(\n `${path}.maxVersion must be a safe integer in the unsigned 32-bit range`,\n );\n }\n }\n }\n return value as unknown as AdapterCapabilityManifest;\n}\n\nfunction diagnostic(\n code: AdapterCapabilityDiagnosticCode,\n path: string,\n message: string,\n): AdapterCapabilityDiagnostic {\n return { code, path, message };\n}\n\nfunction assertRecord(value: unknown, path: string): asserts value is Record<string, unknown> {\n if (value == null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new TypeError(`${path} must be an object`);\n }\n}\n\nfunction assertKnownFields(\n value: Record<string, unknown>,\n expected: readonly string[],\n path: string,\n): void {\n const known = new Set(expected);\n const unknown = Object.keys(value).find((field) => !known.has(field));\n if (unknown !== undefined) throw new TypeError(`${path} has unknown field ${unknown}`);\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n","import type { ApplicationMarquette } from \"./model.js\";\nimport type {\n AdapterCapabilityManifest,\n AdapterCapabilityMismatch,\n AdapterCapabilityMismatchCode,\n AdapterCapabilityNegotiation,\n AdapterCapabilitySupport,\n} from \"./adapter-model.js\";\nimport { validateAdapterCapabilityManifest } from \"./adapter-validate.js\";\n\n/**\n * Negotiates application capability requirements against one adapter.\n *\n * Requirement identifiers are deduplicated and sorted. Unknown application\n * capability identifiers fail closed instead of being treated as adapter\n * omissions. An invalid manifest never produces a compatible result.\n */\nexport function negotiateAdapterCapabilities(\n marquette: ApplicationMarquette,\n requiredCapabilities: readonly string[],\n manifest: AdapterCapabilityManifest,\n): AdapterCapabilityNegotiation {\n const diagnostics = validateAdapterCapabilityManifest(manifest);\n const support = new Map(\n (manifest.capabilities ?? []).map((capability) => [capability.id, capability] as const),\n );\n const mismatches = [...new Set(requiredCapabilities)]\n .sort()\n .flatMap((id) => mismatch(marquette, id, support.get(id), diagnostics.length === 0));\n\n return {\n adapter: manifest.adapter,\n compatible: diagnostics.length === 0 && mismatches.length === 0,\n diagnostics,\n mismatches,\n };\n}\n\nfunction mismatch(\n marquette: ApplicationMarquette,\n id: string,\n support: AdapterCapabilitySupport | undefined,\n manifestIsValid: boolean,\n): AdapterCapabilityMismatch[] {\n const declarations = marquette.capabilities;\n const requirement =\n declarations && Object.hasOwn(declarations, id) ? declarations[id] : undefined;\n if (requirement === undefined) return [problem(\"unknown-requirement\", id)];\n const requiredVersion = requirement.version === undefined ? 1 : requirement.version;\n if (!Number.isInteger(requiredVersion) || requiredVersion < 1 || requiredVersion > 0xffff_ffff) {\n return [problem(\"invalid-requirement-version\", id)];\n }\n if (!manifestIsValid) return [];\n\n if (support === undefined) return [problem(\"missing-capability\", id, requiredVersion)];\n if (requiredVersion < support.minVersion) {\n return [problem(\"version-below-minimum\", id, requiredVersion, support)];\n }\n if (requiredVersion > support.maxVersion) {\n return [problem(\"version-above-maximum\", id, requiredVersion, support)];\n }\n return [];\n}\n\nfunction problem(\n code: AdapterCapabilityMismatchCode,\n capability: string,\n requiredVersion?: number,\n support?: AdapterCapabilitySupport,\n): AdapterCapabilityMismatch {\n return {\n code,\n capability,\n path: `capabilities.${capability}`,\n message: mismatchMessage(code),\n ...(requiredVersion === undefined ? {} : { requiredVersion }),\n ...(support === undefined\n ? {}\n : { minVersion: support.minVersion, maxVersion: support.maxVersion }),\n };\n}\n\nfunction mismatchMessage(code: AdapterCapabilityMismatchCode): string {\n switch (code) {\n case \"unknown-requirement\":\n return \"application references an undeclared capability requirement\";\n case \"invalid-requirement-version\":\n return \"application capability version must be a positive unsigned 32-bit integer\";\n case \"missing-capability\":\n return \"adapter does not support the required capability\";\n case \"version-below-minimum\":\n return \"application requires a capability version below the adapter minimum\";\n case \"version-above-maximum\":\n return \"application requires a capability version above the adapter maximum\";\n }\n}\n","/** Stable discriminator for serialized native build profiles. */\nexport const NATIVE_BUILD_PROFILE_FORMAT = \"vize.native-build-profile\" as const;\n\n/** Current serialized native build profile version. */\nexport const NATIVE_BUILD_PROFILE_FORMAT_VERSION = 1 as const;\n\n/** Native application platforms understood by the managed build contract. */\nexport type NativeBuildPlatform = \"android\" | \"ios\";\n\n/** Intended lifecycle stage of a native build. */\nexport type NativeBuildConfiguration = \"development\" | \"preview\" | \"production\";\n\n/** Installation or distribution destination produced by one target. */\nexport type NativeBuildDestination = \"simulator\" | \"device\" | \"store\";\n\n/** How signing material is selected without embedding credentials in the profile. */\nexport type NativeBuildSigning = \"none\" | \"automatic\" | \"manual\";\n\n/** One platform and destination emitted from a native build profile. */\nexport interface NativeBuildTarget {\n /** Native platform to build. */\n readonly platform: NativeBuildPlatform;\n /** Installation or distribution destination. */\n readonly destination: NativeBuildDestination;\n /**\n * Signing selection implemented by the local or hosted executor.\n *\n * Credentials are supplied out of band and never serialized here.\n *\n * @default \"none\"\n */\n readonly signing?: NativeBuildSigning;\n}\n\n/** Over-the-air update selection attached to a native build. */\nexport interface NativeBuildUpdateSelection {\n /** Portable rollout channel identifier. */\n readonly channel: string;\n /** Runtime compatibility version checked before applying an update. */\n readonly runtimeVersion: string;\n}\n\n/**\n * Language-neutral profile consumed unchanged by local and hosted native builders.\n *\n * Execution location, credentials, and secret values deliberately stay outside\n * this record so the exact same profile can be admitted by either executor.\n */\nexport interface NativeBuildProfile {\n /** Serialized record discriminator. */\n readonly format: typeof NATIVE_BUILD_PROFILE_FORMAT;\n /** Serialized contract version. */\n readonly formatVersion: typeof NATIVE_BUILD_PROFILE_FORMAT_VERSION;\n /** Stable profile identifier, such as `development` or `production`. */\n readonly profile: string;\n /** Intended lifecycle stage of the produced artifacts. */\n readonly configuration: NativeBuildConfiguration;\n /** Native environment identifier declared by the application marquette. */\n readonly environment: string;\n /** Non-empty platform and destination matrix. */\n readonly targets: readonly NativeBuildTarget[];\n /**\n * Native capabilities required by every target in this profile.\n *\n * @default []\n */\n readonly capabilities?: readonly string[];\n /** Optional over-the-air update compatibility selection. */\n readonly updates?: NativeBuildUpdateSelection;\n}\n\n/** Stable validation code for a native build profile. */\nexport type NativeBuildProfileDiagnosticCode =\n | \"invalid-format\"\n | \"invalid-format-version\"\n | \"invalid-profile-id\"\n | \"invalid-environment-id\"\n | \"missing-target\"\n | \"duplicate-target\"\n | \"store-requires-production\"\n | \"store-requires-signing\"\n | \"invalid-update-channel\"\n | \"invalid-runtime-version\"\n | \"invalid-capability-id\"\n | \"duplicate-capability\";\n\n/** Deterministic semantic validation diagnostic for a native build profile. */\nexport interface NativeBuildProfileDiagnostic {\n /** Stable machine-readable diagnostic code. */\n readonly code: NativeBuildProfileDiagnosticCode;\n /** JSON-style path of the invalid value. */\n readonly path: string;\n /** Human-readable explanation shared by every executor. */\n readonly message: string;\n}\n","import {\n NATIVE_BUILD_PROFILE_FORMAT,\n NATIVE_BUILD_PROFILE_FORMAT_VERSION,\n type NativeBuildProfile,\n type NativeBuildProfileDiagnostic,\n type NativeBuildProfileDiagnosticCode,\n} from \"./native-build-model.js\";\n\nconst IDENTIFIER = /^[a-z0-9][a-z0-9._-]*$/;\nconst RUNTIME_VERSION = /^[0-9A-Za-z][0-9A-Za-z._+-]*$/;\nconst CONFIGURATIONS = new Set([\"development\", \"preview\", \"production\"]);\nconst PLATFORMS = new Set([\"android\", \"ios\"]);\nconst DESTINATIONS = new Set([\"simulator\", \"device\", \"store\"]);\nconst SIGNING_MODES = new Set([\"none\", \"automatic\", \"manual\"]);\nconst DIAGNOSTIC_ORDER: Record<NativeBuildProfileDiagnosticCode, number> = {\n \"invalid-format\": 0,\n \"invalid-format-version\": 1,\n \"invalid-profile-id\": 2,\n \"invalid-environment-id\": 3,\n \"missing-target\": 4,\n \"duplicate-target\": 5,\n \"store-requires-production\": 6,\n \"store-requires-signing\": 7,\n \"invalid-update-channel\": 8,\n \"invalid-runtime-version\": 9,\n \"invalid-capability-id\": 10,\n \"duplicate-capability\": 11,\n};\n\n/** Validates a native build profile without mutating it. */\nexport function validateNativeBuildProfile(\n profile: NativeBuildProfile,\n): NativeBuildProfileDiagnostic[] {\n const diagnostics: NativeBuildProfileDiagnostic[] = [];\n if (profile.format !== NATIVE_BUILD_PROFILE_FORMAT) {\n diagnostics.push(\n diagnostic(\"invalid-format\", \"format\", \"unsupported native build profile format\"),\n );\n }\n if (profile.formatVersion !== NATIVE_BUILD_PROFILE_FORMAT_VERSION) {\n diagnostics.push(\n diagnostic(\n \"invalid-format-version\",\n \"formatVersion\",\n \"unsupported native build profile format version\",\n ),\n );\n }\n if (!IDENTIFIER.test(profile.profile)) {\n diagnostics.push(\n diagnostic(\n \"invalid-profile-id\",\n \"profile\",\n \"profile must be a lowercase portable identifier\",\n ),\n );\n }\n if (!IDENTIFIER.test(profile.environment)) {\n diagnostics.push(\n diagnostic(\n \"invalid-environment-id\",\n \"environment\",\n \"environment must be a lowercase portable identifier\",\n ),\n );\n }\n if (profile.targets.length === 0) {\n diagnostics.push(\n diagnostic(\"missing-target\", \"targets\", \"native build profile must declare a target\"),\n );\n }\n\n const seenTargets = new Set<string>();\n for (const [index, target] of profile.targets.entries()) {\n const path = `targets.${index}`;\n const key = `${target.platform}:${target.destination}`;\n if (seenTargets.has(key)) {\n diagnostics.push(\n diagnostic(\n \"duplicate-target\",\n path,\n \"platform and destination must be unique within the native build profile\",\n ),\n );\n }\n seenTargets.add(key);\n if (target.destination === \"store\" && profile.configuration !== \"production\") {\n diagnostics.push(\n diagnostic(\n \"store-requires-production\",\n path,\n \"store targets require the production configuration\",\n ),\n );\n }\n if (target.destination === \"store\" && (target.signing ?? \"none\") === \"none\") {\n diagnostics.push(\n diagnostic(\n \"store-requires-signing\",\n `${path}.signing`,\n \"store targets require automatic or manual signing\",\n ),\n );\n }\n }\n\n if (profile.updates !== undefined) {\n if (!IDENTIFIER.test(profile.updates.channel)) {\n diagnostics.push(\n diagnostic(\n \"invalid-update-channel\",\n \"updates.channel\",\n \"update channel must be a lowercase portable identifier\",\n ),\n );\n }\n if (!RUNTIME_VERSION.test(profile.updates.runtimeVersion)) {\n diagnostics.push(\n diagnostic(\n \"invalid-runtime-version\",\n \"updates.runtimeVersion\",\n \"runtime version must be a portable non-empty version token\",\n ),\n );\n }\n }\n\n const seenCapabilities = new Set<string>();\n for (const [index, capability] of (profile.capabilities ?? []).entries()) {\n const path = `capabilities.${index}`;\n if (!IDENTIFIER.test(capability)) {\n diagnostics.push(\n diagnostic(\n \"invalid-capability-id\",\n path,\n \"capability id must be a lowercase portable identifier\",\n ),\n );\n }\n if (seenCapabilities.has(capability)) {\n diagnostics.push(\n diagnostic(\n \"duplicate-capability\",\n path,\n \"capability id must be unique within the native build profile\",\n ),\n );\n }\n seenCapabilities.add(capability);\n }\n\n return diagnostics.sort(\n (left, right) =>\n compareText(left.path, right.path) ||\n DIAGNOSTIC_ORDER[left.code] - DIAGNOSTIC_ORDER[right.code] ||\n compareText(left.message, right.message),\n );\n}\n\n/**\n * Parses an untrusted native build profile with strict structural checks.\n *\n * Unknown fields and mismatched primitive or enum values throw before a local\n * or hosted executor can inspect semantic diagnostics.\n */\nexport function parseNativeBuildProfile(value: unknown): NativeBuildProfile {\n assertRecord(value, \"profile\");\n assertKnownFields(\n value,\n [\n \"format\",\n \"formatVersion\",\n \"profile\",\n \"configuration\",\n \"environment\",\n \"targets\",\n \"capabilities\",\n \"updates\",\n ],\n \"profile\",\n );\n assertString(value.format, \"format\");\n if (\n typeof value.formatVersion !== \"number\" ||\n !Number.isSafeInteger(value.formatVersion) ||\n value.formatVersion < 0\n ) {\n throw new TypeError(\"formatVersion must be a safe integer\");\n }\n assertString(value.profile, \"profile\");\n assertEnum(value.configuration, CONFIGURATIONS, \"configuration\");\n assertString(value.environment, \"environment\");\n if (!Array.isArray(value.targets)) throw new TypeError(\"targets must be an array\");\n for (const [index, target] of value.targets.entries()) {\n const path = `targets.${index}`;\n assertRecord(target, path);\n assertKnownFields(target, [\"platform\", \"destination\", \"signing\"], path);\n assertEnum(target.platform, PLATFORMS, `${path}.platform`);\n assertEnum(target.destination, DESTINATIONS, `${path}.destination`);\n if (target.signing !== undefined) {\n assertEnum(target.signing, SIGNING_MODES, `${path}.signing`);\n }\n }\n if (value.capabilities !== undefined) {\n if (!Array.isArray(value.capabilities)) {\n throw new TypeError(\"capabilities must be an array\");\n }\n for (const [index, capability] of value.capabilities.entries()) {\n assertString(capability, `capabilities.${index}`);\n }\n }\n if (value.updates !== undefined) {\n assertRecord(value.updates, \"updates\");\n assertKnownFields(value.updates, [\"channel\", \"runtimeVersion\"], \"updates\");\n assertString(value.updates.channel, \"updates.channel\");\n assertString(value.updates.runtimeVersion, \"updates.runtimeVersion\");\n }\n return value as unknown as NativeBuildProfile;\n}\n\nfunction diagnostic(\n code: NativeBuildProfileDiagnosticCode,\n path: string,\n message: string,\n): NativeBuildProfileDiagnostic {\n return { code, path, message };\n}\n\nfunction assertRecord(value: unknown, path: string): asserts value is Record<string, unknown> {\n if (value == null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new TypeError(`${path} must be an object`);\n }\n}\n\nfunction assertKnownFields(\n value: Record<string, unknown>,\n expected: readonly string[],\n path: string,\n): void {\n const known = new Set(expected);\n const unknown = Object.keys(value).find((field) => !known.has(field));\n if (unknown !== undefined) throw new TypeError(`${path} has unknown field ${unknown}`);\n}\n\nfunction assertString(value: unknown, path: string): asserts value is string {\n if (typeof value !== \"string\") throw new TypeError(`${path} must be a string`);\n}\n\nfunction assertEnum(value: unknown, expected: ReadonlySet<string>, path: string): void {\n if (typeof value !== \"string\" || !expected.has(value)) {\n throw new TypeError(`${path} must be a supported string value`);\n }\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n","import type {\n ApplicationMarquette,\n MARQUETTE_FORMAT_VERSION,\n MarquetteEnvironment,\n MarquetteRoute,\n MarquetteTarget,\n RenderingMode,\n} from \"./model.js\";\n\n/** Severity of an application-marquette diagnostic. */\nexport type MarquetteDiagnosticSeverity = \"error\" | \"warning\";\n\n/** Stable, source-addressable application-marquette diagnostic. */\nexport interface MarquetteDiagnostic {\n /** Stable machine-readable diagnostic code. */\n readonly code: `VIZE_MARQUETTE_${string}`;\n /** Severity used by CLI, editor, test, and CI consumers. */\n readonly severity: MarquetteDiagnosticSeverity;\n /** JSON-style path into the authored marquette. */\n readonly path: string;\n /** Human-readable explanation and next action. */\n readonly message: string;\n}\n\nconst IDENTIFIER = /^[a-z0-9][a-z0-9._-]*$/;\nconst SUPPORTED_FORMAT_VERSION: typeof MARQUETTE_FORMAT_VERSION = 1;\n\n/**\n * Validates a complete application marquette.\n *\n * Diagnostics cover structural, reference, capability, target, and dependency\n * invariants. Results are sorted by path, code, and message so identical input\n * produces stable editor, CLI, test, and CI output.\n *\n * This function does not mutate the authored object and does not throw.\n */\nexport function validateApplicationMarquette(\n marquette: ApplicationMarquette,\n): MarquetteDiagnostic[] {\n const diagnostics: MarquetteDiagnostic[] = [];\n const environments = marquette.environments ?? [];\n const backends = marquette.backends ?? [];\n const protocols = marquette.protocols ?? [];\n const routes = marquette.routes ?? [];\n const targets = new Set(marquette.targets ?? []);\n const capabilityIds = new Set(Object.keys(marquette.capabilities ?? {}));\n\n if ((marquette.formatVersion ?? SUPPORTED_FORMAT_VERSION) !== SUPPORTED_FORMAT_VERSION) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_001\", \"formatVersion\", \"unsupported marquette format version\"),\n );\n }\n\n validateIdentifier(marquette.application, \"application\", \"VIZE_MARQUETTE_002\", diagnostics);\n\n for (const [key, capability] of Object.entries(marquette.capabilities ?? {})) {\n const path = contractPath(\"capabilities\", key);\n validateIdentifier(key, path, \"VIZE_MARQUETTE_003\", diagnostics);\n if (key !== capability.id) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_004\", path, \"capability map key must equal capability.id\"),\n );\n }\n const version = capability.version === undefined ? 1 : capability.version;\n if (!Number.isInteger(version) || version < 1 || version > 0xffff_ffff) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_005\",\n path,\n version === 0\n ? \"capability version must be greater than zero\"\n : \"capability version must be a positive unsigned 32-bit integer\",\n ),\n );\n }\n if (capability.description.trim().length === 0) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_024\", path, \"capability description must not be empty\"),\n );\n }\n }\n\n const environmentIds = collectUniqueIds(\"environments\", environments, diagnostics);\n const backendIds = collectUniqueIds(\"backends\", backends, diagnostics);\n const protocolIds = collectUniqueIds(\"protocols\", protocols, diagnostics);\n collectUniqueIds(\"routes\", routes, diagnostics);\n\n for (const environment of environments) {\n const path = contractPath(\"environments\", environment.id);\n if (!targets.has(environment.target)) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_007\", path, \"environment target must be declared in targets\"),\n );\n }\n for (const dependency of [...new Set(environment.dependsOn ?? [])].sort()) {\n if (dependency === environment.id) {\n diagnostics.push(error(\"VIZE_MARQUETTE_008\", path, \"environment cannot depend on itself\"));\n } else if (!environmentIds.has(dependency)) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_009\", path, \"environment dependency does not exist\"),\n );\n }\n }\n validateCapabilities(path, environment.capabilities, capabilityIds, diagnostics);\n\n if (\n environment.consumer === \"client\" &&\n (environment.runtime === \"rust\" ||\n environment.runtime === \"go\" ||\n environment.runtime === \"jvm\")\n ) {\n diagnostics.push(\n warning(\n \"VIZE_MARQUETTE_010\",\n path,\n \"client environment uses a server-oriented runtime; declare an adapter capability if this is intentional\",\n ),\n );\n }\n }\n\n validateEnvironmentCycles(environments, diagnostics);\n\n for (const backend of backends) {\n const path = contractPath(\"backends\", backend.id);\n if (backend.environment != null) {\n const environment = environments.find((candidate) => candidate.id === backend.environment);\n if (environment == null) {\n diagnostics.push(error(\"VIZE_MARQUETTE_011\", path, \"backend environment does not exist\"));\n } else if (environment.consumer !== \"server\") {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_012\", path, \"backend environment must be a server consumer\"),\n );\n }\n }\n validateCapabilities(path, backend.capabilities, capabilityIds, diagnostics);\n }\n\n for (const protocol of protocols) {\n const path = contractPath(\"protocols\", protocol.id);\n if (!backendIds.has(protocol.backend)) {\n diagnostics.push(error(\"VIZE_MARQUETTE_013\", path, \"protocol backend does not exist\"));\n }\n validateCapabilities(path, protocol.capabilities, capabilityIds, diagnostics);\n }\n\n const routePaths = new Map<string, string>();\n for (const route of routes) {\n const path = contractPath(\"routes\", route.id);\n if (!route.path.startsWith(\"/\")) {\n diagnostics.push(error(\"VIZE_MARQUETTE_014\", path, \"route path must start with /\"));\n }\n const environment = environments.find((candidate) => candidate.id === route.environment);\n if (environment == null) {\n diagnostics.push(error(\"VIZE_MARQUETTE_015\", path, \"route environment does not exist\"));\n }\n if (route.backend != null && !backendIds.has(route.backend)) {\n diagnostics.push(error(\"VIZE_MARQUETTE_016\", path, \"route backend does not exist\"));\n }\n if (route.protocol != null) {\n const protocol = protocols.find((candidate) => candidate.id === route.protocol);\n if (!protocolIds.has(route.protocol) || protocol == null) {\n diagnostics.push(error(\"VIZE_MARQUETTE_017\", path, \"route protocol does not exist\"));\n } else if (route.backend != null && protocol.backend !== route.backend) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_018\",\n path,\n \"route protocol and backend must refer to the same service\",\n ),\n );\n }\n }\n if (environment != null && !renderingMatchesTarget(route, environment.target)) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_023\",\n path,\n \"rendering mode is not compatible with the route environment target\",\n ),\n );\n }\n validateCapabilities(path, route.capabilities, capabilityIds, diagnostics);\n\n const routeKey = `${route.environment}\\u0000${route.path}`;\n const previous = routePaths.get(routeKey);\n if (previous != null) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_019\", path, `route path is already used by route \"${previous}\"`),\n );\n }\n routePaths.set(routeKey, route.id);\n }\n\n for (const target of targets) {\n if (!environments.some((environment) => environment.target === target)) {\n diagnostics.push(\n warning(\"VIZE_MARQUETTE_020\", \"targets\", \"declared target has no environment\"),\n );\n }\n }\n\n return diagnostics.sort(compareDiagnostics);\n}\n\nfunction collectUniqueIds(\n collection: string,\n values: readonly { readonly id: string }[],\n diagnostics: MarquetteDiagnostic[],\n): Set<string> {\n const ids = new Set<string>();\n for (const value of values) {\n const path = contractPath(collection, value.id);\n validateIdentifier(value.id, path, \"VIZE_MARQUETTE_006\", diagnostics);\n if (ids.has(value.id)) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_006\", path, \"identifier must be unique within its collection\"),\n );\n }\n ids.add(value.id);\n }\n return ids;\n}\n\nfunction validateIdentifier(\n id: string,\n path: string,\n code: `VIZE_MARQUETTE_${string}`,\n diagnostics: MarquetteDiagnostic[],\n): void {\n if (!IDENTIFIER.test(id)) {\n diagnostics.push(\n error(\n code,\n path,\n \"identifier must use lowercase ASCII letters, digits, dash, underscore, or dot\",\n ),\n );\n }\n}\n\nfunction validateCapabilities(\n path: string,\n capabilities: readonly string[] | undefined,\n declared: ReadonlySet<string>,\n diagnostics: MarquetteDiagnostic[],\n): void {\n for (const capability of [...new Set(capabilities ?? [])].sort()) {\n if (!declared.has(capability)) {\n diagnostics.push(error(\"VIZE_MARQUETTE_021\", path, \"referenced capability is not declared\"));\n }\n }\n}\n\nfunction validateEnvironmentCycles(\n environments: readonly MarquetteEnvironment[],\n diagnostics: MarquetteDiagnostic[],\n): void {\n const graph = new Map(environments.map((value) => [value.id, value.dependsOn ?? []]));\n const visiting = new Set<string>();\n const visited = new Set<string>();\n\n for (const id of [...graph.keys()].sort()) {\n if (hasCycle(id, graph, visiting, visited)) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_022\",\n contractPath(\"environments\", id),\n \"environment dependency graph must be acyclic\",\n ),\n );\n }\n }\n}\n\nfunction hasCycle(\n id: string,\n graph: ReadonlyMap<string, readonly string[]>,\n visiting: Set<string>,\n visited: Set<string>,\n): boolean {\n if (visited.has(id)) return false;\n if (visiting.has(id)) return true;\n visiting.add(id);\n const cyclic = [...(graph.get(id) ?? [])]\n .sort()\n .some((dependency) => graph.has(dependency) && hasCycle(dependency, graph, visiting, visited));\n visiting.delete(id);\n visited.add(id);\n return cyclic;\n}\n\nfunction renderingMatchesTarget(route: MarquetteRoute, target: MarquetteTarget): boolean {\n const targetRendering: Partial<Record<RenderingMode, MarquetteTarget>> = {\n native: \"native\",\n desktop: \"desktop\",\n terminal: \"terminal\",\n };\n return (targetRendering[route.rendering] ?? \"web\") === target;\n}\n\nfunction compareDiagnostics(left: MarquetteDiagnostic, right: MarquetteDiagnostic): number {\n return (\n compareText(left.path, right.path) ||\n compareText(left.code, right.code) ||\n compareText(left.message, right.message)\n );\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction contractPath(collection: string, id: string): string {\n return `${collection}.${id}`;\n}\n\nfunction error(\n code: `VIZE_MARQUETTE_${string}`,\n path: string,\n message: string,\n): MarquetteDiagnostic {\n return { code, severity: \"error\", path, message };\n}\n\nfunction warning(\n code: `VIZE_MARQUETTE_${string}`,\n path: string,\n message: string,\n): MarquetteDiagnostic {\n return { code, severity: \"warning\", path, message };\n}\n","import type {\n AdapterCapabilityDiagnostic,\n AdapterCapabilityManifest,\n AdapterCapabilityMismatch,\n} from \"./adapter-model.js\";\nimport { negotiateAdapterCapabilities } from \"./adapter-negotiate.js\";\nimport { parseAdapterCapabilityManifest } from \"./adapter-validate.js\";\nimport type { ApplicationMarquette } from \"./model.js\";\nimport type { NativeBuildProfile, NativeBuildProfileDiagnostic } from \"./native-build-model.js\";\nimport { parseNativeBuildProfile, validateNativeBuildProfile } from \"./native-build-validate.js\";\nimport { validateApplicationMarquette, type MarquetteDiagnostic } from \"./validate.js\";\n\n/** Application-to-build binding failure that must prevent executor scheduling. */\nexport interface NativeBuildBindingDiagnostic {\n /** Stable machine-readable binding refusal. */\n readonly code: \"unknown-environment\" | \"environment-not-native\" | \"environment-not-client\";\n /** Location of the profile or application value that prevents admission. */\n readonly path: string;\n /** Human-readable explanation shared by local and hosted executors. */\n readonly message: string;\n}\n\n/** A source-qualified finding retained from every native build admission layer. */\nexport type NativeBuildAdmissionDiagnostic =\n | (MarquetteDiagnostic & {\n /** Contract layer that owns this finding. */\n readonly source: \"application\";\n })\n | (NativeBuildProfileDiagnostic & {\n /** Contract layer that owns this finding. */\n readonly source: \"profile\";\n /** Build refusal severity. */\n readonly severity: \"error\";\n })\n | (NativeBuildBindingDiagnostic & {\n /** Contract layer that owns this finding. */\n readonly source: \"binding\";\n /** Build refusal severity. */\n readonly severity: \"error\";\n })\n | (AdapterCapabilityDiagnostic & {\n /** Contract layer that owns this finding. */\n readonly source: \"adapter\";\n /** Build refusal severity. */\n readonly severity: \"error\";\n })\n | (AdapterCapabilityMismatch & {\n /** Contract layer that owns this finding. */\n readonly source: \"capability\";\n /** Build refusal severity. */\n readonly severity: \"error\";\n });\n\n/** Deterministic decision computed before a local or hosted native build runs. */\nexport interface NativeBuildAdmission {\n /** Whether every contract, environment binding, and capability requirement passed. */\n readonly allowed: boolean;\n /** Profile whose configuration was admitted or refused. */\n readonly profile: string;\n /** Application environment selected by that profile. */\n readonly environment: string;\n /** Adapter whose capability ranges were checked. */\n readonly adapter: string;\n /** Sorted union of profile, environment, and selected-route capability requirements. */\n readonly capabilities: readonly string[];\n /** Source-qualified findings in stable source, path, code, and message order. */\n readonly diagnostics: readonly NativeBuildAdmissionDiagnostic[];\n}\n\n/**\n * Binds a native build profile to an application and a concrete adapter manifest.\n *\n * Standalone profile validation cannot establish that the selected environment\n * exists, is a native client, or that its routes can execute with the adapter.\n * Admission checks all three contracts and negotiates the deduplicated union of\n * profile, environment, and selected-route capabilities. Invalid application,\n * profile, or adapter contracts and unsupported capability versions fail closed.\n * Strict profile and adapter parsing runs first: malformed fields, unknown\n * executor or secret fields, and unsafe numeric bounds throw `TypeError` before\n * graph inspection. Semantically invalid contracts return `allowed: false`.\n *\n * This experimental synchronous decision neither schedules a build nor handles\n * secrets. Executors must inspect `allowed` immediately before scheduling, using\n * the same inputs they pass to the build. Application warnings remain visible\n * without becoming errors. Inputs are not mutated; cost is linear in contract\n * collections plus sorting their diagnostics and required capability identifiers.\n */\nexport function admitNativeBuildProfile(\n marquette: ApplicationMarquette,\n profile: NativeBuildProfile,\n adapter: AdapterCapabilityManifest,\n): NativeBuildAdmission {\n parseNativeBuildProfile(profile);\n parseAdapterCapabilityManifest(adapter);\n const environment = marquette.environments?.find(({ id }) => id === profile.environment);\n const capabilities = [\n ...new Set([\n ...(profile.capabilities ?? []),\n ...(environment?.capabilities ?? []),\n ...(marquette.routes ?? [])\n .filter((route) => route.environment === profile.environment)\n .flatMap((route) => route.capabilities ?? []),\n ]),\n ].sort();\n const negotiation = negotiateAdapterCapabilities(marquette, capabilities, adapter);\n const diagnostics: NativeBuildAdmissionDiagnostic[] = [\n ...validateApplicationMarquette(marquette).map((diagnostic) => ({\n ...diagnostic,\n source: \"application\" as const,\n })),\n ...validateNativeBuildProfile(profile).map((diagnostic) => ({\n ...diagnostic,\n source: \"profile\" as const,\n severity: \"error\" as const,\n })),\n ...bindingDiagnostics(environment, profile.environment).map((diagnostic) => ({\n ...diagnostic,\n source: \"binding\" as const,\n severity: \"error\" as const,\n })),\n ...negotiation.diagnostics.map((diagnostic) => ({\n ...diagnostic,\n source: \"adapter\" as const,\n severity: \"error\" as const,\n })),\n ...negotiation.mismatches.map((diagnostic) => ({\n ...diagnostic,\n source: \"capability\" as const,\n severity: \"error\" as const,\n })),\n ];\n diagnostics.sort(\n (left, right) =>\n compareText(left.source, right.source) ||\n compareText(left.path, right.path) ||\n compareText(left.code, right.code) ||\n compareText(left.message, right.message),\n );\n return {\n allowed: negotiation.compatible && !diagnostics.some(({ severity }) => severity === \"error\"),\n profile: profile.profile,\n environment: profile.environment,\n adapter: adapter.adapter,\n capabilities,\n diagnostics,\n };\n}\n\nfunction bindingDiagnostics(\n environment: { readonly target: string; readonly consumer: string } | undefined,\n id: string,\n): NativeBuildBindingDiagnostic[] {\n if (environment === undefined) {\n return [\n {\n code: \"unknown-environment\",\n path: \"environment\",\n message: \"native build environment is not declared by the application\",\n },\n ];\n }\n const diagnostics: NativeBuildBindingDiagnostic[] = [];\n if (environment.target !== \"native\") {\n diagnostics.push({\n code: \"environment-not-native\",\n path: `environments.${id}.target`,\n message: \"native builds require an environment with the native target\",\n });\n }\n if (environment.consumer !== \"client\") {\n diagnostics.push({\n code: \"environment-not-client\",\n path: `environments.${id}.consumer`,\n message: \"native builds require a client environment\",\n });\n }\n return diagnostics;\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ?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