@plasius/gpu-model-core 0.2.0 → 0.3.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 CHANGED
@@ -69,6 +69,72 @@ UI capability. Synthetic contract fixtures cover glTF, OBJ, FBX and CAD reports;
69
69
  actual parsing and geometry verification belong to their format adapters.
70
70
  See [ADR-0008](docs/adrs/adr-0008-bounded-adapter-diagnostics-and-repair-ledgers.md).
71
71
 
72
+ ## Canonical conversion resource graph
73
+
74
+ `createGpuModelResourceGraph` projects a privately verified `GpuModelDocument`
75
+ into a frozen dependency graph for resources, accessors, textures, materials,
76
+ skeletons (including joints), skins, animations, provenance and conversion
77
+ packages. It reuses the canonical values and immutable `Blob` payloads. Material
78
+ bindings retain samplers and intended usage; texture values retain their hashes,
79
+ MIME types, paths, colour spaces and export embedding policy.
80
+
81
+ ```ts
82
+ import { createGpuModelResourceGraph, gpuModelResourceKey,
83
+ type GpuModelDocument } from "@plasius/gpu-model-core";
84
+
85
+ declare const document: GpuModelDocument; // From the verification factory.
86
+ const graph = createGpuModelResourceGraph(document, {
87
+ resources: document.resources.map(resource => ({
88
+ resourceId: resource.id,
89
+ location: { kind: "embedded" },
90
+ exportEmbeddingPolicy: "inherit-source",
91
+ })),
92
+ packages: [{ id: "conversion", members: document.resources.map(resource => ({
93
+ kind: "resource", id: resource.id,
94
+ })) }],
95
+ });
96
+ const conversion = graph.nodes.find(node =>
97
+ node.key === gpuModelResourceKey("package", "conversion"));
98
+ ```
99
+
100
+ Supply exactly one binding per document resource. For external origins use
101
+ `location: { kind: "external", relativePath: "textures/albedo.png" }`; the bytes
102
+ must already have been resolved and verified. Paths use portable ASCII letters,
103
+ digits, dots, underscores, hyphens and slash separators, with no absolute paths,
104
+ traversal, URL syntax, device names or trailing dots. Components are at most 255
105
+ characters and paths at most 1024. Case-insensitive duplicate paths and file versus
106
+ directory collisions fail. Descriptors do not authorize network/file access.
107
+
108
+ Resource export policies are `inherit-source`, `prefer-embedded`,
109
+ `prefer-external` and `forbid-embedding`. The last requires an external origin.
110
+ Exporters must satisfy resource and texture restrictions together, resolve
111
+ preferences for the target, enforce destination-root confinement and validate
112
+ their actual output. The graph neither writes packages nor proves export success.
113
+ Asset catalogue admission and promotion remain owned by `@plasius/asset-contracts`.
114
+
115
+ `gpuModelResourceKey(kind, id)` encodes a JSON tuple, independent of declaration
116
+ order and locale. Logical IDs are distinct from byte-content hashes. Nodes and
117
+ dependency keys are sorted; joint/animation sample order stays intact. Package
118
+ members are typed references, may include packages, and must form a DAG. Missing,
119
+ repeated or cyclic references fail with fixed `GpuModelResourceGraphError.code`
120
+ values. Canonical document validation still owns scene and semantic references.
121
+ Animation target associations remain in canonical values, outside dependency
122
+ edges. This is a resource dependency graph, not a replacement scene graph.
123
+
124
+ `GPU_MODEL_RESOURCE_GRAPH_LIMITS` caps 65536 nodes, 262144 dependency declarations
125
+ (including repeated semantic dependencies before deduplication), and 256 packages.
126
+ These ceilings may reject a large otherwise-valid canonical document. Construction
127
+ performs no I/O, retries, logging or hashing; input accessors and malformed
128
+ containers fail closed. Do not treat executable JavaScript Proxies as inert input.
129
+ `isGpuModelResourceGraph` recognizes only locally constructed graphs. Structured
130
+ clones must be rebuilt from a reverified document. The graph retains authored
131
+ metadata and provenance: it is not a redaction boundary or a public logging format.
132
+
133
+ Adoption inherits the remotely evaluated `gpu.model.conversion.enabled` flag;
134
+ rollback disables conversion adoption and pins the prior package release. No
135
+ stored flag or UI capability changes here. See
136
+ [ADR-0009](docs/adrs/adr-0009-canonical-conversion-resource-graph.md).
137
+
72
138
  ## Implementation tracker
73
139
 
74
140
  The canonical conversion architecture is defined by [ADR 0094 in `plasius-ltd-site`](https://github.com/Plasius-LTD/plasius-ltd-site/blob/main/docs/adrs/adr-0094-gpu-model-family-and-canonical-proxy-conversion.md). The package implementation work is split into Project-tracked Tasks: