@plasius/asset-contracts 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -14,6 +14,40 @@
14
14
  - **Security**
15
15
  - (placeholder)
16
16
 
17
+ ## [0.8.0] - 2026-10-24
18
+
19
+ - **Added**
20
+ - Opt-in model promotion composition binds complete source/output resource
21
+ bytes, conversion diagnostics and existing approval gates, with exact prior
22
+ package rollback and immutable source/derived lineage.
23
+ - (placeholder)
24
+
25
+ - **Changed**
26
+ - (placeholder)
27
+
28
+ - **Fixed**
29
+ - (placeholder)
30
+
31
+ - **Security**
32
+ - (placeholder)
33
+
34
+ ## [0.7.0] - 2026-10-24
35
+
36
+ - **Added**
37
+ - Opt-in reloadable canonical texture/material resource qualification, exact
38
+ storage role/MIME mapping and separate GPU upload/atlas source bindings.
39
+ Preserves authored metadata and original resource identity through JSON reload.
40
+ - (placeholder)
41
+
42
+ - **Changed**
43
+ - (placeholder)
44
+
45
+ - **Fixed**
46
+ - (placeholder)
47
+
48
+ - **Security**
49
+ - (placeholder)
50
+
17
51
  ## [0.6.0] - 2026-10-24
18
52
 
19
53
  - **Added**
@@ -349,3 +383,5 @@
349
383
  [0.4.6]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.4.6
350
384
  [0.5.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.5.0
351
385
  [0.6.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.6.0
386
+ [0.7.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.7.0
387
+ [0.8.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.8.0
package/README.md CHANGED
@@ -11,6 +11,52 @@
11
11
  Canonical contracts for Plasius asset jobs, model resolution, immutable WebGPU
12
12
  shader assets, screenshot plans, reviews, and promotion records.
13
13
 
14
+ ## Model resource promotion closure
15
+
16
+ `createModelResourcePromotionRecord(input, options?)` composes a typed
17
+ `AssetPromotionRecord<ModelAssetManifest>`, complete source and output byte
18
+ inventories, raw conversion diagnostics, explicit public resource bindings,
19
+ and existing `ModelCandidate` / `ModelCandidateConfirmation` evidence. The
20
+ output uses the existing texture/resource qualification input. Source and
21
+ output must have distinct immutable asset/version identities. Runtime URIs
22
+ end in `/assetId/version/entrypoint` and satisfy existing immutable HTTPS rules.
23
+
24
+ The boundary verifies all file paths/hashes/lengths/MIME, original/derived
25
+ lineage, converter/source/output identity, re-evaluated diagnostics and runtime
26
+ resource bindings before calling `createGpuAssetPromotionRecord`. Review must
27
+ pass without blocking findings; existing rights, security, fidelity, render,
28
+ GPU envelope and human confirmation contracts remain required. Every runtime
29
+ LOD/collision/fidelity resource and projected diagnostic resource needs one
30
+ `{ resource, package: "source" | "output", filePath }` binding to verified bytes.
31
+
32
+ The frozen result retains `promotion`, `source`, qualified `output`, evaluated
33
+ `diagnostics`, sorted `resourceBindings`, `candidate`, `confirmation` and a
34
+ separate deterministic `closureHash`. This package digest includes both complete
35
+ inventories and lineage; it preserves existing candidate leaf/assembly hash
36
+ semantics. No bytes or Blobs are retained. Raw provider diagnostic text is
37
+ excluded; authored package and candidate metadata remain trusted content that
38
+ callers must minimize before public distribution.
39
+
40
+ For `outcome: "rolled-back"`, supply `rollback: { prior, current }` with results
41
+ qualified by this same installed module instance. Requalify the exact prior
42
+ source/output bytes and approval gates; target version/manifest/closure/runtime
43
+ URI must match `prior`, and `rollbackOfVersion` must equal `current`'s distinct
44
+ version for the same asset/channel. The result names both exact closure hashes.
45
+ New independent confirmation is allowed without changing package identity.
46
+ Forward calls reject rollback metadata. A JSON clone has no local qualification
47
+ brand: reconstruct and qualify its original inputs before using it as history.
48
+
49
+ This function performs no storage or pointer changes. Hosted services own
50
+ signature/issuer verification, authenticated immutable history, create-only
51
+ version admission and pointer-last concurrency control. Local qualification
52
+ does not prove embedded model references, derivation algorithms or GPU matrix
53
+ policy; existing downstream gates still apply. Fixed metadata/byte limits,
54
+ abort and a default 10s deadline (configurable 1–60s) bound work. Errors contain
55
+ fixed codes only. Backend `gpu.model.conversion.enabled` controls opt-in caller
56
+ adoption; disabled/rollback adoption retains existing factories. Capability N/A
57
+ for this package-only API. See [ADR0012](./docs/adrs/adr-0012-model-resource-promotion-closure.md)
58
+ and [TDR0007](./docs/tdrs/tdr-0007-model-resource-promotion-closure.md).
59
+
14
60
  ## Install
15
61
 
16
62
  ```bash
@@ -28,6 +74,7 @@ The exported surface covers:
28
74
  - asset job metadata contracts
29
75
  - manifest and file descriptor contracts
30
76
  - opt-in canonical model package inventory and exact-byte qualification
77
+ - reloadable canonical texture/material metadata and explicit upload/atlas roles
31
78
  - opt-in public-safe canonical conversion diagnostics and resource/source binding
32
79
  - screenshot plan definitions
33
80
  - review findings and review report contracts
@@ -91,8 +138,8 @@ Embedded resources remain inside their owning entrypoint; list only actual
91
138
  exported files. This helper checks bytes and declarations, not internal format
92
139
  references, MIME sniffing, malware, rendering, storage or promotion authority.
93
140
  Keep source provenance in the canonical document and do not substitute derived
94
- hashes for original source hashes. Detailed role mapping, animation/source
95
- relationships and promotion closure remain separately tracked work. The result
141
+ hashes for original source hashes. Role qualification is available through the additive helper below; animation/source
142
+ relationships remain adapter-owned; promotion composition uses the opt-in closure boundary above. The result
96
143
  is qualification at call time; callers must preserve the exact bytes in their
97
144
  own immutable storage boundary.
98
145
 
@@ -105,6 +152,71 @@ runtime parser or renderer loading. Downstream adoption must use a released
105
152
  package. See [ADR 0009](./docs/adrs/adr-0009-model-resource-manifest-qualification.md)
106
153
  and [TDR 0004](./docs/tdrs/tdr-0004-model-resource-manifest-qualification.md).
107
154
 
155
+ ## Reloadable Texture and Resource Roles
156
+
157
+ `qualifyModelTextureResources` composes exact byte/inventory qualification with
158
+ published model-core's verified material/texture graph. It keeps authored
159
+ metadata and source image identity separate from derived GPU uploads/atlases.
160
+
161
+ ```ts
162
+ import { qualifyModelTextureResources } from "@plasius/asset-contracts";
163
+
164
+ const reload = await qualifyModelTextureResources({
165
+ manifest, packageManifest, files: exportedFiles,
166
+ graph: verifiedCanonicalGraph,
167
+ resources: [
168
+ { resourceId: "source-image", filePath: "textures/source.png" },
169
+ { resourceId: "embedded-buffer", filePath: "model.gltf" },
170
+ ], // Exactly one binding per graph resource.
171
+ derived: [
172
+ { role: "gpu-upload", filePath: "derived/upload.bin", sourceResourceIds: ["source-image"] },
173
+ { role: "texture-atlas", filePath: "derived/atlas.png", sourceResourceIds: ["source-image"] },
174
+ ], // Or [] when no derivative is exported.
175
+ }, { signal: abortController.signal, timeoutMs: 10_000 });
176
+ // Persist JSON.stringify(reload) alongside the qualified immutable bytes.
177
+ ```
178
+
179
+ Use existing storage roles: canonical texture → texture with PNG/JPEG/WebP/KTX2
180
+ MIME; material/animation → metadata with application/json; mesh → model or
181
+ binary; auxiliary → binary or JSON metadata. Uploads require auxiliary/binary
182
+ buffer files, atlases texture/image files. See TDR 0006 for the exact MIME table.
183
+ Missing/duplicate resources, incompatible roles/MIME, unknown roles, graph
184
+ clones and source/output collisions reject. External files match graph path,
185
+ hash, byte length and MIME; embedded resources name the owning model entrypoint
186
+ and retain their independent resource hash. List only actual exported files.
187
+
188
+ The frozen version-1 result contains manifest, original source provenance,
189
+ resources, canonical materials/textures and derived records. Authored usage,
190
+ color space, sampler, binding transform, embedding policy and sourceMetadata
191
+ survive JSON reload. Original image IDs and bytes are never replaced by atlas
192
+ hashes or upload paths. No Blob payload or renderer allocation is serialized.
193
+ Adapters own model-internal references, derivation algorithms and image content
194
+ inspection; qualification does not attest those operations or grant promotion.
195
+ Task 12 animation schemas and Task 23 shader ABI remain separate;
196
+ promotion composition uses the opt-in closure boundary above.
197
+
198
+ This is **trusted package metadata**, including names, extensions, original
199
+ paths and authored sourceMetadata. Minimize/sanitize that data before public
200
+ distribution; use the separate public diagnostics API for technical responses.
201
+ Serialized graphs lose their private brand: verify reloaded canonical resources
202
+ and reconstruct a graph through core before qualifying again. Produce graphs
203
+ with the same installed model-core instance and matching module format (ESM
204
+ import with ESM, require with CJS). The normal named guard import preserves that
205
+ identity; unused exports remain tree-shakeable through sideEffects=false.
206
+
207
+ Inputs/bytes are snapshotted before awaiting. Fixed ceilings are 16,384 resource
208
+ bindings, 4,096 derivatives, 65,536 graph nodes, shared 262,144 metadata values,
209
+ 2,097,152 UTF-16 characters, depth 16 and 2,048 characters/string. Existing file
210
+ limits also apply. Default deadline 10 seconds, allowed range 1–60,000 ms;
211
+ cancellation/deadline reject without a partial result. In-flight Web Crypto
212
+ cannot be cancelled. ModelTextureResourceError.code is value-free.
213
+
214
+ The backend evaluator gpu.model.conversion.enabled controls caller adoption;
215
+ disabled/rollback paths retain legacy factories. No lookup/mutation or UI
216
+ capability is introduced. Dependencies and legacy factories are unchanged.
217
+ See [ADR 0011](./docs/adrs/adr-0011-reloadable-texture-resource-roles.md) and
218
+ [TDR 0006](./docs/tdrs/tdr-0006-reloadable-texture-resource-roles.md).
219
+
108
220
  ## Public Conversion Diagnostics
109
221
 
110
222
  `qualifyModelConversionDiagnostics` adds an opt-in, version-1 JSON boundary over