@plasius/gpu-shader 0.1.0 → 0.1.1

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 CHANGED
@@ -70,31 +70,42 @@ Release preparation always opens a short-lived `release/v*` pull request with
70
70
  an installation token from the repository's release-preparation GitHub App.
71
71
  The workflow refuses to mutate metadata unless `main` is protected and
72
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.
73
+ protected-main validation commit before any release artifact is built. If
74
+ preparation merges package or changelog metadata, the original run remains
75
+ bound to its earlier SHA and stops before publication. Start a second
76
+ `bump: none` run from the newly prepared `main` commit; `bump: none` resumes
77
+ that exact version and does not replace version preparation.
78
78
 
79
79
  CD then crosses an explicit privilege boundary. The read-only,
80
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.
81
+ validation commit, checks out the immutable release source commit, installs
82
+ dependencies, runs all release gates, and packs the package once. For a new
83
+ publication those commits must be identical. During recovery of an exact
84
+ already-published version, the release commit is derived from npm SLSA
85
+ provenance, must match the existing tag, and must remain an ancestor of the
86
+ validation commit. The attempt-scoped artifact contains exactly the npm
87
+ tarball, reproducible CycloneDX SBOM, and transport manifest; the release uses
88
+ a fixed Node/npm toolchain, and npm's volatile SBOM UUID and timestamp are
89
+ deterministically derived from the release source before schema v2 binds both
90
+ commit authorities, the file sizes and digests, package identity, and workflow
91
+ run.
85
92
  The production `publish` job does not check out the repository or execute
86
93
  checked-out package code. It downloads the artifact by its exact run-scoped identity
87
94
  and GitHub artifact digest, revalidates the three-file closure and every bound
88
95
  digest, resolves authoritative live npm state, and preflights the complete
89
96
  GitHub tag/release/SBOM state before any mutation. Prerelease status and the npm
90
97
  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.
98
+ inputs. For a new publication, only then does the job attest, tag, publish, and
99
+ finalize the release. For an already-published recovery it verifies and
100
+ reconciles the same immutable state but does not create replacement tarball or
101
+ SBOM attestations.
92
102
 
93
103
  Publication and recovery use that same tarball identity: an existing registry
94
104
  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.
105
+ npm SLSA provenance for the immutable release commit and protected-main
106
+ `cd.yml`, verifies npm registry signatures, and confirms the GitHub tag and
107
+ non-draft release point to that release commit. Recovery does not create new
108
+ tarball or SBOM attestations under the newer validation commit.
98
109
 
99
110
  The first public version requires the production-environment `NPM_TOKEN`
100
111
  because npm trusted publishing cannot be configured until the package exists.
@@ -281,7 +292,10 @@ It contains 15 representative physical cells and one required Ubuntu Chromium
281
292
  SwiftShader smoke cell. All 16 are blocking; only the 15 physical cells count
282
293
  toward stable physical support. A skip, timeout, unavailable runner or adapter,
283
294
  device loss, missing result, stale evidence, or unexpected result fails the
284
- gate.
295
+ gate. The checked-in file is the exact canonical JSON policy artifact; its byte
296
+ digest must equal `SUPPORTED_STABLE_WEBGPU_MATRIX_POLICIES[0].matrixSha256`.
297
+ Any policy-byte or digest change requires complete shader-inventory
298
+ requalification and does not itself qualify a shader.
285
299
 
286
300
  Candidate archives may contain only declarative JSON, WGSL, and bounded binary
287
301
  fixtures. Physical runners execute a pinned trusted harness from this
package/dist/cli.cjs CHANGED
@@ -615,7 +615,7 @@ var SUPPORTED_STABLE_WEBGPU_MATRIX_POLICIES = [
615
615
  Object.freeze({
616
616
  matrixId: "stable-webgpu",
617
617
  matrixVersion: "2026-07-13",
618
- matrixSha256: "9b47ff8162b055d49e38c4fe90b9074992ab8c9e1125926e936f8122e6119fd8"
618
+ matrixSha256: "4620eca44fd03004ee7650cfe9fcf42934493611a5097da5525f71578980b016"
619
619
  })
620
620
  ];
621
621
  Object.freeze(SUPPORTED_STABLE_WEBGPU_MATRIX_POLICIES);
@@ -8726,7 +8726,7 @@ function validatePipelineInterfaces(input) {
8726
8726
  // package.json
8727
8727
  var package_default = {
8728
8728
  name: "@plasius/gpu-shader",
8729
- version: "0.1.0",
8729
+ version: "0.1.1",
8730
8730
  description: "Reflection-first WebGPU WGSL interfaces, CPU codecs, compatibility validation, style profiles, and qualification tooling",
8731
8731
  type: "module",
8732
8732
  sideEffects: false,
@@ -10556,6 +10556,13 @@ function keys(value, expected) {
10556
10556
  const set = new Set(expected);
10557
10557
  return Object.keys(value).every((key) => set.has(key)) && expected.every((key) => key in value);
10558
10558
  }
10559
+ function canonicalEqual2(left, right) {
10560
+ try {
10561
+ return canonicalizeGpuContract(left) === canonicalizeGpuContract(right);
10562
+ } catch {
10563
+ return false;
10564
+ }
10565
+ }
10559
10566
  var browserNames = /* @__PURE__ */ new Set(["chromium", "chrome", "edge", "firefox", "safari"]);
10560
10567
  var osNames = /* @__PURE__ */ new Set(["ubuntu", "windows", "macos", "chromeos", "android", "ios", "ipados", "visionos"]);
10561
10568
  var backends = /* @__PURE__ */ new Set(["swiftshader", "d3d12", "metal", "vulkan"]);
@@ -10649,7 +10656,9 @@ function validateStableWebGpuMatrix(value) {
10649
10656
  const kind = String(requirement?.kind);
10650
10657
  const validRequirement = requirement && (kind === "exact" ? keys(requirement, ["kind", "value"]) && typeof requirement.value === "string" && /^\d+(?:\.\d+)*$/u.test(requirement.value) : kind === "major" || kind === "minimum-major" ? keys(requirement, ["kind", "value"]) && Number.isSafeInteger(requirement.value) && Number(requirement.value) > 0 : kind === "stable-channel" && keys(requirement, ["kind", "channel"]) && requirement.channel === "stable");
10651
10658
  if (!validRequirement) diagnostics.push(issue3("OS version requirement is invalid.", `${path2}.os.versionRequirement`));
10652
- if (typeof cell.cellId === "string" && JSON.stringify(requirement) !== JSON.stringify(VERSION_REQUIREMENTS.get(cell.cellId))) diagnostics.push(issue3("OS version requirement differs from the stable baseline.", `${path2}.os.versionRequirement`));
10659
+ if (typeof cell.cellId === "string" && !canonicalEqual2(requirement, VERSION_REQUIREMENTS.get(cell.cellId))) {
10660
+ diagnostics.push(issue3("OS version requirement differs from the stable baseline.", `${path2}.os.versionRequirement`));
10661
+ }
10653
10662
  }
10654
10663
  if (!adapter || !keys(adapter, ["kind", "vendor", "family", "backend"]) || !["software", "physical"].includes(String(adapter.kind)) || !backends.has(String(adapter.backend))) diagnostics.push(issue3("Adapter descriptor is invalid.", `${path2}.adapter`));
10655
10664
  if (!adapterAutomation || !keys(adapterAutomation, ["kind"]) || !automation.has(String(adapterAutomation.kind))) diagnostics.push(issue3("Automation descriptor is invalid.", `${path2}.automation`));
@@ -11684,7 +11693,7 @@ function createQualificationExecutionProducer(input) {
11684
11693
  }
11685
11694
 
11686
11695
  // src/testing/runner/identity.ts
11687
- function canonicalEqual2(left, right) {
11696
+ function canonicalEqual3(left, right) {
11688
11697
  return canonicalizeGpuContract(left) === canonicalizeGpuContract(right);
11689
11698
  }
11690
11699
  function required2(environment, name) {
@@ -11720,7 +11729,7 @@ async function validateTrustedCellIdentity(input) {
11720
11729
  } catch (cause) {
11721
11730
  throw new TypeError("Stable WebGPU matrix bytes are not UTF-8 JSON.", { cause });
11722
11731
  }
11723
- if (!canonicalEqual2(parsedMatrix, input.matrix) || matrixSha256 !== input.preflight.matrixSha256) {
11732
+ if (!canonicalEqual3(parsedMatrix, input.matrix) || matrixSha256 !== input.preflight.matrixSha256) {
11724
11733
  throw new TypeError("Exact stable WebGPU matrix artifact differs from qualification preflight evidence.");
11725
11734
  }
11726
11735
  if (input.preflight.contractVersion !== SHADER_VALIDATION_EVIDENCE_VERSION || input.preflight.kind !== "shader-qualification-preflight") throw new TypeError("Qualification preflight contract is unsupported.");
@@ -11749,7 +11758,7 @@ async function validateTrustedCellIdentity(input) {
11749
11758
  environment
11750
11759
  });
11751
11760
  const runner = input.runnerPreflight;
11752
- if (runner.contractVersion !== SHADER_VALIDATION_EVIDENCE_VERSION || runner.kind !== "shader-runner-cell-preflight-evidence" || runner.qualificationId !== input.preflight.qualificationId || runner.cellId !== input.cell.cellId || runner.status !== "available" || runner.matrixSha256 !== matrixSha256 || !canonicalEqual2(runner.runnerLabels, input.cell.runnerLabels) || !canonicalEqual2(runner.qualificationPreflightProvenance, input.preflight.provenance) || !runner.matchedRunners.some((candidate) => {
11761
+ if (runner.contractVersion !== SHADER_VALIDATION_EVIDENCE_VERSION || runner.kind !== "shader-runner-cell-preflight-evidence" || runner.qualificationId !== input.preflight.qualificationId || runner.cellId !== input.cell.cellId || runner.status !== "available" || runner.matrixSha256 !== matrixSha256 || !canonicalEqual3(runner.runnerLabels, input.cell.runnerLabels) || !canonicalEqual3(runner.qualificationPreflightProvenance, input.preflight.provenance) || !runner.matchedRunners.some((candidate) => {
11753
11762
  const labels = new Set(candidate.labels.map((label) => label.toLocaleLowerCase("en-US")));
11754
11763
  return candidate.name === executionProducer.runner.name && runner.runnerLabels.every((label) => labels.has(label.toLocaleLowerCase("en-US")));
11755
11764
  })) {
@@ -11757,7 +11766,7 @@ async function validateTrustedCellIdentity(input) {
11757
11766
  }
11758
11767
  const selectorProducer = parseQualificationExecutionProducer(runner.producer, "runnerPreflight.producer");
11759
11768
  const expectedSelectorJob = input.cell.adapter.kind === "software" ? "swiftshader" : "physical-runner-preflight";
11760
- if (selectorProducer.job !== expectedSelectorJob || selectorProducer.repository !== input.preflight.provenance.repository || !canonicalEqual2(selectorProducer.commit, input.preflight.provenance.commit) || selectorProducer.ref !== input.preflight.provenance.ref || selectorProducer.runId !== input.preflight.provenance.runId || selectorProducer.runAttempt !== input.preflight.provenance.runAttempt || selectorProducer.trustedWorkflowRef !== input.preflight.provenance.workflowRef || !canonicalEqual2(selectorProducer.trustedWorkflowSha, input.preflight.provenance.workflowSha)) {
11769
+ if (selectorProducer.job !== expectedSelectorJob || selectorProducer.repository !== input.preflight.provenance.repository || !canonicalEqual3(selectorProducer.commit, input.preflight.provenance.commit) || selectorProducer.ref !== input.preflight.provenance.ref || selectorProducer.runId !== input.preflight.provenance.runId || selectorProducer.runAttempt !== input.preflight.provenance.runAttempt || selectorProducer.trustedWorkflowRef !== input.preflight.provenance.workflowRef || !canonicalEqual3(selectorProducer.trustedWorkflowSha, input.preflight.provenance.workflowSha)) {
11761
11770
  throw new TypeError("Runner-preflight producer differs from the immutable qualification route.");
11762
11771
  }
11763
11772
  return executionProducer;
@@ -11774,7 +11783,7 @@ async function createHostedSwiftShaderRunnerPreflight(input) {
11774
11783
  } catch (cause) {
11775
11784
  throw new TypeError("Stable WebGPU matrix bytes are not UTF-8 JSON.", { cause });
11776
11785
  }
11777
- if (!canonicalEqual2(parsedMatrix, input.matrix) || matrixSha256 !== input.preflight.matrixSha256) {
11786
+ if (!canonicalEqual3(parsedMatrix, input.matrix) || matrixSha256 !== input.preflight.matrixSha256) {
11778
11787
  throw new TypeError("Hosted runner preflight matrix artifact differs from qualification preflight.");
11779
11788
  }
11780
11789
  assertTrustedPreflightEnvironment({ preflight: input.preflight, environment });
@@ -11784,7 +11793,7 @@ async function createHostedSwiftShaderRunnerPreflight(input) {
11784
11793
  }
11785
11794
  const observedHost = await observeTrustedRunnerHost(input.cell, { name: producer.runner.name, labels: [] });
11786
11795
  const hostedLabels = [`${observedHost.os.name}-${observedHost.os.version}`];
11787
- if (!canonicalEqual2(hostedLabels, input.cell.runnerLabels)) {
11796
+ if (!canonicalEqual3(hostedLabels, input.cell.runnerLabels)) {
11788
11797
  throw new TypeError("Actual hosted runner image does not derive the fixed matrix scheduler label.");
11789
11798
  }
11790
11799
  let playwright;
@@ -12054,7 +12063,7 @@ function validateModelShaderCompatibility(input) {
12054
12063
  }
12055
12064
 
12056
12065
  // src/testing/runner/reflection-proof.ts
12057
- function canonicalEqual3(left, right) {
12066
+ function canonicalEqual4(left, right) {
12058
12067
  return canonicalizeGpuContract(left) === canonicalizeGpuContract(right);
12059
12068
  }
12060
12069
  async function createTrustedReflectionProof(admitted) {
@@ -12083,12 +12092,12 @@ async function createTrustedReflectionProof(admitted) {
12083
12092
  const usedPipelineIds = /* @__PURE__ */ new Set();
12084
12093
  const assemblySha256ByUnit = /* @__PURE__ */ new Map();
12085
12094
  for (const unit of admitted.manifest.inventory.compileUnits) {
12086
- if (!canonicalEqual3(unit.interfaceRef, admitted.shaderManifestCore.gpuInterface)) {
12095
+ if (!canonicalEqual4(unit.interfaceRef, admitted.shaderManifestCore.gpuInterface)) {
12087
12096
  throw new TypeError(`Compile unit ${unit.compileUnitId} interface reference differs from the admitted shader core.`);
12088
12097
  }
12089
12098
  for (const pipeline2 of unit.pipelines) {
12090
12099
  const declared = shaderPipelines.get(pipeline2.pipelineId);
12091
- if (!declared || !canonicalEqual3(declared, pipeline2)) {
12100
+ if (!declared || !canonicalEqual4(declared, pipeline2)) {
12092
12101
  throw new TypeError(`Compile unit ${unit.compileUnitId} pipeline ${pipeline2.pipelineId} differs from the admitted shader core.`);
12093
12102
  }
12094
12103
  usedPipelineIds.add(pipeline2.pipelineId);
@@ -12102,7 +12111,7 @@ async function createTrustedReflectionProof(admitted) {
12102
12111
  constants.set(name, value);
12103
12112
  }
12104
12113
  }
12105
- if (!canonicalEqual3(Object.fromEntries([...constants.entries()].sort()), unit.overrideValues)) {
12114
+ if (!canonicalEqual4(Object.fromEntries([...constants.entries()].sort()), unit.overrideValues)) {
12106
12115
  throw new TypeError(`Compile unit ${unit.compileUnitId} override set differs from its exact pipeline constants.`);
12107
12116
  }
12108
12117
  assemblySha256ByUnit.set(unit.compileUnitId, await computeSha256(canonicalizeGpuContract({
@@ -12128,7 +12137,7 @@ async function createTrustedReflectionProof(admitted) {
12128
12137
  if (!compatibility.ok) throw new TypeError(compatibility.diagnostics.map((item) => item.message).join("; "));
12129
12138
  compatibleHashes.add(model.modelAbiHash);
12130
12139
  }
12131
- if (!canonicalEqual3([...compatibleHashes].sort(), [...admitted.manifest.subject.modelAbiHashes].sort())) {
12140
+ if (!canonicalEqual4([...compatibleHashes].sort(), [...admitted.manifest.subject.modelAbiHashes].sort())) {
12132
12141
  throw new TypeError("Admitted model compatibility fixtures differ from the qualification subject ABI set.");
12133
12142
  }
12134
12143
  const reflectionSha256 = await computeSha256(canonicalizeGpuContract({
@@ -12162,7 +12171,7 @@ var BROWSER_PHASES = [
12162
12171
  "bounded-execution",
12163
12172
  "semantic-readback"
12164
12173
  ];
12165
- function canonicalEqual4(left, right) {
12174
+ function canonicalEqual5(left, right) {
12166
12175
  return canonicalizeGpuContract(left) === canonicalizeGpuContract(right);
12167
12176
  }
12168
12177
  function concrete(value, label) {
@@ -12193,7 +12202,7 @@ function validateObservation(input) {
12193
12202
  throw new TypeError("Trusted WebGPU execution did not pass all eight browser phases in fixed order.");
12194
12203
  }
12195
12204
  const observed = result.observed;
12196
- if (observed.runner.id !== runnerName || !canonicalEqual4(observed.runner.labels, expectedRunner.labels)) {
12205
+ if (observed.runner.id !== runnerName || !canonicalEqual5(observed.runner.labels, expectedRunner.labels)) {
12197
12206
  throw new TypeError("Observed runner identity differs from API-verified runner preflight evidence.");
12198
12207
  }
12199
12208
  if (observed.os.name !== cell.os.name || observed.os.architecture !== cell.os.architecture || !versionMatches(cell, observed.os.version, observed.os.channel)) {
@@ -12279,7 +12288,7 @@ async function runTrustedQualificationCell(input) {
12279
12288
  const apiRunner = input.runnerPreflight.matchedRunners.find((runner) => runner.name === producer.runner.name);
12280
12289
  if (!apiRunner) throw new TypeError("Execution runner was not matched by runner preflight evidence.");
12281
12290
  const host = await withinDeadline((input.observeHost ?? observeTrustedRunnerHost)(input.cell, apiRunner), deadline);
12282
- if (host.runner.id !== producer.runner.name || !canonicalEqual4(host.runner.labels, apiRunner.labels)) {
12291
+ if (host.runner.id !== producer.runner.name || !canonicalEqual5(host.runner.labels, apiRunner.labels)) {
12283
12292
  throw new TypeError("Observed controller runner differs from API-verified preflight evidence.");
12284
12293
  }
12285
12294
  const packageMetadata = await withinDeadline(readTrustedHarnessPackageMetadata(), deadline);
@@ -12287,7 +12296,7 @@ async function runTrustedQualificationCell(input) {
12287
12296
  input.adapterFactory ?? defaultTrustedQualificationAdapterFactory,
12288
12297
  input.cell
12289
12298
  ), deadline);
12290
- if (input.runnerPreflight.adapterHarness !== null && !canonicalEqual4(
12299
+ if (input.runnerPreflight.adapterHarness !== null && !canonicalEqual5(
12291
12300
  { id: adapter.automation.driver, version: adapter.automation.version, sha256: adapter.automation.sha256 },
12292
12301
  input.runnerPreflight.adapterHarness
12293
12302
  )) {