@plasius/gpu-shader 0.1.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/LICENSE ADDED
@@ -0,0 +1,203 @@
1
+ Copyright 2026 Plasius LTD
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,434 @@
1
+ # @plasius/gpu-shader
2
+
3
+ Reflection-first contracts, CPU codecs, compatibility checks, style-profile
4
+ activation, and qualification tooling for WebGPU WGSL shaders.
5
+
6
+ > **Qualification status:** the declared physical WebGPU runner fleet has not
7
+ > been verified as provisioned, so this repository does not currently make a
8
+ > universal hardware-support claim for any shader. Missing physical cells fail
9
+ > closed.
10
+
11
+ ## Why this package exists
12
+
13
+ A WGSL module can compile while its CPU producer still writes the wrong bytes.
14
+ `@plasius/gpu-shader` makes the final assembled WGSL the source of truth for
15
+ host-shareable layout and carries that truth through model storage and runtime:
16
+
17
+ - reflect records, bindings, entry points, overrides, and shader inputs from
18
+ final assembled WGSL;
19
+ - generate TypeScript record types, byte constants, and CPU codecs from the
20
+ reflected manifest;
21
+ - distinguish the model-facing `modelAbiHash` from the complete
22
+ `shaderAbiHash`;
23
+ - load only promoted, immutable, digest-verified shader and style manifests;
24
+ - validate model semantics and device capabilities before resource creation;
25
+ - prepare a replacement style off-frame and activate it atomically at a frame
26
+ boundary; and
27
+ - bind qualification evidence to exact shader bytes, compile units, fixtures,
28
+ matrix policy, harness, and CI provenance.
29
+
30
+ Only WGSL is in scope. GLSL, SPIR-V, caller-supplied byte layouts, arbitrary
31
+ Blob URLs, and executable qualification bundles are rejected by design.
32
+
33
+ ## Package boundaries
34
+
35
+ The package has three explicit exports:
36
+
37
+ | Export | Environment | Purpose |
38
+ | --- | --- | --- |
39
+ | `@plasius/gpu-shader` | Browser and Node.js | Contracts, strict manifest parsers, hashes, codecs, compatibility checks, catalog loading, and style activation |
40
+ | `@plasius/gpu-shader/node` | Node.js only | WGSL reflection, final-interface validation, and generated artifacts |
41
+ | `@plasius/gpu-shader/testing` | Test and qualification tooling | Compile-unit inventory, stable-matrix validation, trusted cell execution, and evidence aggregation |
42
+
43
+ The root export must remain browser-safe. Reflection and qualification tooling
44
+ are loaded through subpaths so browser bundles do not eagerly include Node.js
45
+ or browser-automation dependencies.
46
+
47
+ The primary browser-safe APIs are `createGpuRecordCodec`,
48
+ `computeGpuAbiHash`, `validateModelShaderCompatibility`,
49
+ `loadShaderStyleProfile`, `prepareStyleProfile`,
50
+ `createShaderStyleController`, and `activateStyleProfile`, together with the
51
+ strict manifest parsers and versioned contracts. The build APIs
52
+ `reflectGpuInterface`, `validateAssembledGpuInterface`, and
53
+ `generateGpuInterfaceArtifacts` are exposed only from the Node subpath.
54
+
55
+ ## Installation
56
+
57
+ After an approved GitHub CD release publishes the package:
58
+
59
+ ```bash
60
+ npm install @plasius/gpu-shader
61
+ ```
62
+
63
+ Do not publish from a local machine. Releases are produced only by
64
+ `.github/workflows/cd.yml` from `main` through the protected `production`
65
+ environment.
66
+
67
+ ### Release controls
68
+
69
+ Release preparation always opens a short-lived `release/v*` pull request with
70
+ an installation token from the repository's release-preparation GitHub App.
71
+ The workflow refuses to mutate metadata unless `main` is protected and
72
+ repository auto-merge is enabled. The workflow-dispatch SHA must equal the
73
+ prepared commit before any release artifact is built. If preparation merges a
74
+ package or changelog metadata commit, the original run remains bound to its
75
+ earlier SHA and stops before publication. Start a second `bump: none` run from
76
+ the newly prepared `main` commit; `bump: none` resumes that exact version and
77
+ does not replace version preparation.
78
+
79
+ CD then crosses an explicit privilege boundary. The read-only,
80
+ unprivileged `validate-and-pack` job waits for successful push CI on the exact
81
+ prepared commit, installs dependencies, runs all release gates, and packs the
82
+ package once. It uploads an attempt-scoped artifact containing exactly the npm
83
+ tarball, CycloneDX SBOM, and transport manifest; the artifact and manifest bind
84
+ their file sizes, digests, package identity, prepared commit, and workflow run.
85
+ The production `publish` job does not check out the repository or execute
86
+ checked-out package code. It downloads the artifact by its exact run-scoped identity
87
+ and GitHub artifact digest, revalidates the three-file closure and every bound
88
+ digest, resolves authoritative live npm state, and preflights the complete
89
+ GitHub tag/release/SBOM state before any mutation. Prerelease status and the npm
90
+ dist-tag are derived from the transported semantic version rather than retry
91
+ inputs. Only then does the job attest, tag, publish, and finalize the release.
92
+
93
+ Publication and recovery use that same tarball identity: an existing registry
94
+ version is accepted only when its SHA-512 integrity is identical. CD requires
95
+ npm SLSA provenance for the exact `main` commit and `cd.yml` workflow, verifies
96
+ npm registry signatures, and confirms the GitHub tag and non-draft release
97
+ point to the same commit.
98
+
99
+ The first public version requires the production-environment `NPM_TOKEN`
100
+ because npm trusted publishing cannot be configured until the package exists.
101
+ After that version is published, configure npm trusted publishing for
102
+ `Plasius-LTD/gpu-shader`, workflow `cd.yml`, environment `production`, and
103
+ remove `NPM_TOKEN`. See the
104
+ [fleet and repository setup runbook](docs/operations/physical-fleet-readiness.md#repository-configuration).
105
+
106
+ ## Reflect final assembled WGSL
107
+
108
+ Reflection is a build-time Node.js operation. Selectors identify which
109
+ reflected declarations are model-facing; they cannot provide offsets, sizes,
110
+ alignment, or strides.
111
+
112
+ ```ts
113
+ import {
114
+ generateGpuInterfaceArtifacts,
115
+ reflectGpuInterface,
116
+ } from "@plasius/gpu-shader/node";
117
+
118
+ const gpuInterface = await reflectGpuInterface({
119
+ interfaceId: "plasius.model.surface",
120
+ interfaceVersion: "1.0.0",
121
+ modules: [{ moduleId: "material", source: finalAssembledWgsl }],
122
+ pipelines: [materialPipelineDescriptor],
123
+ modelFacingRecordNames: ["Vertex", "Material"],
124
+ modelFacingBindings: [
125
+ { moduleId: "material", group: 0, binding: 0, semantic: "model.vertices" },
126
+ ],
127
+ semantics: [
128
+ {
129
+ semantic: "model.vertices",
130
+ source: { kind: "binding", moduleId: "material", group: 0, binding: 0 },
131
+ },
132
+ ],
133
+ });
134
+
135
+ const generated = generateGpuInterfaceArtifacts(gpuInterface);
136
+ // Write generated.manifestJson, generated.typescriptTypes,
137
+ // generated.jsonSchemas, generated.byteConstants, and generated.codecs in the
138
+ // owning build step.
139
+ ```
140
+
141
+ Every final compile unit should also call `validateAssembledGpuInterface` to
142
+ regenerate its interface and compare it with the canonical model-facing ABI.
143
+ `generatedBy.packageVersion` is read from this package's release-owned package
144
+ metadata. Reflection callers cannot supply or override that version, so
145
+ generated artifacts and qualification evidence identify the implementation
146
+ that actually produced them.
147
+
148
+ Qualification-bundle admission performs that regeneration again from the
149
+ digest-verified final module bytes and exact shader pipeline descriptors. It
150
+ requires the complete regenerated interface, `modelAbiHash`,
151
+ `interfaceAbiHash`, and `shaderAbiHash` to match the submitted contracts, so a
152
+ caller cannot admit a stale layout by merely rebuilding a self-consistent
153
+ manifest and digest graph. Every compile-unit pipeline and interface reference
154
+ must also exactly match the ABI-hashed shader core, and the inventory must
155
+ exercise every core pipeline.
156
+
157
+ Shader requirements are regenerated from the exact module set and pipeline
158
+ descriptors rather than trusted as an unconstrained sidecar. Comment-free WGSL
159
+ `enable` directives map to stable WebGPU feature names (`f16`,
160
+ `clip_distances`, `dual_source_blending`, `subgroups`, `primitive_index`, and
161
+ `subgroup_size_control`); an unknown or malformed enable fails admission.
162
+ Render target, depth/stencil, and storage-texture formats, unclipped-depth
163
+ support, bind-group and binding counts, per-stage buffer/texture/sampler usage,
164
+ uniform and storage binding sizes, vertex-buffer facts, inter-stage variables
165
+ and components, color-attachment counts, and compute workgroup dimensions,
166
+ invocations, and statically used storage bytes are derived and checked against
167
+ the manifest. Workgroup storage follows WebGPU's per-variable
168
+ `roundUp(16, SizeOf(T))` accounting across the entry point's transitive call
169
+ graph. External textures use their expanded WebGPU resource-slot costs. Every
170
+ model-facing semantic comes from the reflected ABI and must be present in the
171
+ declared requirements.
172
+ Admission and runtime repeat this check after loading the complete exact WGSL
173
+ module set, so declared requirements cannot understate the executable shader.
174
+
175
+ Each compute `GpuEntryPointInterface` records `workgroupStorageSize`; non-compute
176
+ entry points record `null`. Override-sized workgroup arrays currently fail
177
+ reflection closed because `wgsl_reflect` 1.5.0 does not retain the symbolic
178
+ element count needed to bind exact per-pipeline storage bytes.
179
+
180
+ ## Encode CPU records from reflected layout
181
+
182
+ ```ts
183
+ import {
184
+ createGpuRecordCodec,
185
+ parseGpuInterfaceManifest,
186
+ } from "@plasius/gpu-shader";
187
+
188
+ const manifest = parseGpuInterfaceManifest(JSON.parse(interfaceJson));
189
+ const material = manifest.records.find((record) => record.name === "Material");
190
+ if (!material) throw new Error("Material is not present in final WGSL");
191
+
192
+ const codec = createGpuRecordCodec(material, manifest.records);
193
+ const bytes = codec.encode({
194
+ baseColor: [1, 0.4, 0.1, 1],
195
+ roughness: 0.65,
196
+ });
197
+ ```
198
+
199
+ The codec is little-endian, bounds checked, strict about unknown or missing
200
+ members, and writes deterministic zero padding. Unsupported or non-finite
201
+ values fail before upload.
202
+
203
+ ## Validate a model and shader
204
+
205
+ ```ts
206
+ import { validateModelShaderCompatibility } from "@plasius/gpu-shader";
207
+
208
+ const result = validateModelShaderCompatibility({
209
+ model: modelManifest.gpu,
210
+ shader: shaderManifest,
211
+ gpuInterface: loadedGpuInterfaceManifest,
212
+ capabilities: {
213
+ features: [...device.features],
214
+ limits: device.limits,
215
+ formats: runtimeFormats,
216
+ },
217
+ });
218
+
219
+ if (!result.ok) {
220
+ reportShaderDiagnostics(result.diagnostics);
221
+ // Fail closed: do not create model resources or pipelines.
222
+ }
223
+ ```
224
+
225
+ Compatibility requires the exact model interface identity and
226
+ `modelAbiHash`, required model semantics, formats, WebGPU features, and device
227
+ limits. A full `shaderAbiHash` identifies the assembled pipeline interface but
228
+ does not replace the model-facing hash.
229
+
230
+ ## Load and switch a style profile
231
+
232
+ Style profiles map roles such as `material`, `lighting`, `outline`, `shadow`,
233
+ and `post-processing` to exact immutable shader versions.
234
+
235
+ ```ts
236
+ import {
237
+ activateStyleProfile,
238
+ createShaderStyleController,
239
+ loadShaderStyleProfile,
240
+ prepareStyleProfile,
241
+ } from "@plasius/gpu-shader";
242
+
243
+ const loaded = await loadShaderStyleProfile({
244
+ ref: cartoonProfileRef,
245
+ catalog: promotedCatalogResolver,
246
+ });
247
+ if (!loaded.ok) throw new Error("Profile failed immutable loading");
248
+
249
+ const prepared = await prepareStyleProfile({
250
+ loaded: loaded.value,
251
+ model: modelManifest.gpu,
252
+ capabilities,
253
+ device,
254
+ });
255
+ if (!prepared.ok) throw new Error("Profile failed GPU preparation");
256
+
257
+ const controller = createShaderStyleController({ scheduler: frameScheduler });
258
+ const activation = await activateStyleProfile({
259
+ controller,
260
+ prepared: prepared.value,
261
+ });
262
+ ```
263
+
264
+ Preparation verifies digests, compiles modules with
265
+ `getCompilationInfo()`, creates layouts and pipelines, and leaves the current
266
+ profile untouched on failure. Activation swaps only after preparation and at a
267
+ frame boundary. Styles sharing a `modelAbiHash` do not require model-buffer
268
+ repacking; profiles needing extra semantics are offered only to models that
269
+ provide them.
270
+
271
+ ## Qualification policy
272
+
273
+ A compile unit is final assembled WGSL plus its entry point, serializable
274
+ pipeline descriptor, override set, interface reference, resources, and a
275
+ bounded declarative semantic fixture. Every WGSL fragment must be included in
276
+ at least one compile unit.
277
+
278
+ The versioned baseline matrix is
279
+ [`matrices/stable-webgpu-2026-07-13.json`](matrices/stable-webgpu-2026-07-13.json).
280
+ It contains 15 representative physical cells and one required Ubuntu Chromium
281
+ SwiftShader smoke cell. All 16 are blocking; only the 15 physical cells count
282
+ toward stable physical support. A skip, timeout, unavailable runner or adapter,
283
+ device loss, missing result, stale evidence, or unexpected result fails the
284
+ gate.
285
+
286
+ Candidate archives may contain only declarative JSON, WGSL, and bounded binary
287
+ fixtures. Physical runners execute a pinned trusted harness from this
288
+ repository. Candidate JavaScript, shell code, executables, symlinks, devices,
289
+ and executable callbacks are not qualification inputs.
290
+
291
+ Every compile unit must probe both directions of every model-facing byte
292
+ interface it uses:
293
+
294
+ - a `buffer-record` probe is required for each model-facing record binding;
295
+ the reflected CPU codec must reproduce the exact uploaded byte slice, and
296
+ the GPU result is decoded with the reflected output-record codec before its
297
+ semantic value is compared; and
298
+ - a `vertex-input` probe is required for each model ABI vertex semantic; the
299
+ reflected `GPUVertexFormat`, offset, stride, slot, step mode, draw element,
300
+ and semantic determine the exact uploaded byte range, and shader-observed
301
+ output is decoded and compared.
302
+
303
+ A generic readback digest does not replace either structured layout probe.
304
+ Fixture resources are also exact contracts: texture dimension, extent,
305
+ format, usages, mip count, sample count, upload mip/origin/aspect,
306
+ `bytesPerRow`, `rowsPerImage`, and byte length must agree. Texture views,
307
+ attachments, copies, buffer ranges, and readback ranges must stay within those
308
+ declared resources and the fixture's bounded command, memory, texel, and
309
+ timeout limits.
310
+
311
+ Qualification evidence binds a shader-manifest core rather than a profile.
312
+ After that evidence is bound into the final immutable shader manifest, profile
313
+ admission validates its exact shader-version references and their evidence.
314
+ This two-stage sequence keeps profiles exact-version pinned without creating a
315
+ profile/evidence/shader-manifest digest cycle.
316
+
317
+ `validationEvidence` is always bound to one exact supported universal
318
+ stable-WebGPU matrix ID, version, and SHA-256. Optional
319
+ `additionalValidationEvidence` entries are uniquely named scopes such as `xr`,
320
+ each carrying its own exact matrix-policy digest. A style profile pins every
321
+ `requiredValidationScopes` entry to that same scope and exact matrix identity;
322
+ loading rejects a missing or different matrix. Supplemental evidence must be
323
+ an independently identified artifact and attestation: it cannot reuse the
324
+ universal evidence ID, URI, digest, attestation URI, attestation digest, matrix,
325
+ or any corresponding identity from another supplemental result or distinct
326
+ shader version in the profile. Evidence and attestation URIs must use canonical
327
+ URL serialization and remain inside the promoted catalog root.
328
+
329
+ This release intentionally has an empty additive-policy registry. Any
330
+ non-empty `additionalValidationEvidence` or `requiredValidationScopes` fails
331
+ closed until reviewed supplemental matrix bytes, genuinely additive lanes,
332
+ their validator, and their exact scope/ID/version/SHA-256 tuple ship together
333
+ in a framework release. An `xr` label alone can never create XR qualification.
334
+
335
+ ### Exact workflow evidence flow
336
+
337
+ 1. The trusted prepare job fetches one immutable Blob version through OIDC,
338
+ validates the data-only archive, rebuilds the pinned harness, fingerprints
339
+ its exact source and built output, and emits the candidate artifact plus a
340
+ qualification-preflight manifest bound to the candidate, inventory, raw
341
+ matrix bytes, harness, workflow run, attempt, and OIDC subject.
342
+ 2. Runner preflight records the actual runner API name and complete label list
343
+ for every eligible route. Matrix labels are a required subset of those
344
+ actual labels. Hosted SwiftShader can independently fingerprint its adapter
345
+ harness; physical inventory normally records `adapterHarness: null` because
346
+ the GitHub runner API cannot inspect runner-local executable bytes.
347
+ 3. Each execution job rebuilds and verifies the same harness fingerprint,
348
+ consumes the exact candidate, matrix, qualification preflight, and runner
349
+ preflight artifacts, and emits either cell evidence from the actual runner
350
+ or a non-qualifying diagnostic from that job. A timeout, failure, missing
351
+ adapter, or missing artifact never becomes passing evidence.
352
+ Candidate, preflight, runner-preflight, cell, and aggregate transport
353
+ artifacts include the GitHub run attempt so immutable artifacts from a
354
+ rerun cannot collide with or be mixed into another attempt. Cell output is
355
+ published atomically, and the first executable job step creates a typed
356
+ fallback diagnostic for later setup failures.
357
+ 4. Aggregation retains the exact raw matrix artifact, requires one result for
358
+ every compile-unit-by-cell pair, validates the aggregate again, and retains
359
+ `qualification-evidence.json`, its GitHub build-provenance bundle, and the
360
+ strict digest-bearing attestation-reference JSON.
361
+ 5. GitHub artifacts are transport, not durable admission state. Model storage
362
+ must copy and digest-verify the exact candidate, matrix, evidence,
363
+ attestation reference, and attestation bundle into immutable roots before a
364
+ final shader manifest can reference their storage URIs and SHA-256 digests.
365
+ Profile admission follows only after those evidence-bound shader versions
366
+ exist.
367
+
368
+ Physical execution additionally requires a runner-owned, self-contained
369
+ `.mjs` automation adapter registered through Node's preload-only path. Its
370
+ absolute `file:` URL and domain-separated SHA-256 are fixed in runner service
371
+ configuration, and it must live under the platform root documented in the
372
+ [physical fleet readiness runbook](docs/operations/physical-fleet-readiness.md).
373
+ Before execution, a fixed bootstrap resolves the real path, validates the
374
+ reviewed single-file policy and exact digest, and imports an in-memory snapshot
375
+ of those verified bytes. Candidate, preflight, and evidence data live in a
376
+ run/attempt/cell-specific `RUNNER_TEMP` directory that is removed after every
377
+ outcome. The candidate and workflow inputs cannot select or replace executable
378
+ code.
379
+
380
+ See [Qualification evidence and trusted runners](docs/tdrs/tdr-0001-qualification-evidence-and-trusted-runners.md)
381
+ and the [physical fleet readiness runbook](docs/operations/physical-fleet-readiness.md).
382
+
383
+ ## Storage and runtime trust boundary
384
+
385
+ This package defines contracts and validation; it does not own Blob or catalog
386
+ state. Model storage owns immutable model, shader, interface, profile, fixture,
387
+ and evidence bytes. The durable asset catalog owns promoted exact-version
388
+ pointers and rollback. Runtime resolvers must expose only promoted assets and
389
+ must verify manifest and module digests before returning bytes.
390
+
391
+ The rollout flag is `asset.pipeline.shader-store.enabled`. It gates public
392
+ candidate submission and runtime shader/profile discovery, loading and
393
+ activation. Disabling it fails closed; it does not authorize arbitrary Blob
394
+ URLs, checked-in catalogs or unmanaged shaders as a fallback. A separately
395
+ governed, bounded pre-store default may exist only for the documented migration
396
+ window.
397
+
398
+ Separately authorized private intake, qualification, immutable promotion and
399
+ rollback rehearsal remain operable while the flag is off so operators can make
400
+ the store ready without exposing it. The user-visible style-selection
401
+ capability is `gpu.shader.style.select`; rendering a model's promoted default
402
+ profile does not require that capability once runtime store access is enabled.
403
+
404
+ ## Development
405
+
406
+ Use Node.js 24 and npm:
407
+
408
+ ```bash
409
+ npm ci
410
+ npm run lint
411
+ npm run typecheck
412
+ npm run build
413
+ npm run test:coverage
414
+ npm run shader:matrix
415
+ npm run pack:check
416
+ ```
417
+
418
+ Framework TypeScript must maintain at least 80% LCOV line coverage. WGSL is the
419
+ standing line-coverage exception, replaced by 100% compile-unit inventory and
420
+ 100% required matrix-cell passage. See [Testing strategy](docs/testing.md).
421
+
422
+ ## Documentation
423
+
424
+ - [Documentation index](docs/index.md)
425
+ - [Framework design](docs/design/wgsl-shader-compatibility-and-style-framework.md)
426
+ - [ADR: final WGSL is the source of truth](docs/adrs/adr-0001-final-assembled-wgsl-is-the-interface-source-of-truth.md)
427
+ - [TDR: qualification evidence and trusted runners](docs/tdrs/tdr-0001-qualification-evidence-and-trusted-runners.md)
428
+ - [Physical fleet readiness](docs/operations/physical-fleet-readiness.md)
429
+ - [Security policy](SECURITY.md)
430
+ - [Contributing](CONTRIBUTING.md)
431
+
432
+ ## License
433
+
434
+ Apache-2.0. See [LICENSE](LICENSE).