@plasius/gpu-model-core 0.1.0 → 0.2.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 +65 -0
- package/dist/index.cjs +476 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -1
- package/dist/index.d.ts +151 -1
- package/dist/index.js +472 -214
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,71 @@ Canonical model document, resource graph, diagnostics, and adapter contracts.
|
|
|
4
4
|
|
|
5
5
|
This repository is the dedicated package boundary defined by ADR 0094.
|
|
6
6
|
|
|
7
|
+
## Diagnostics, repairs and conversion loss
|
|
8
|
+
|
|
9
|
+
`evaluateGpuModelDiagnostics` validates a format adapter's completed report.
|
|
10
|
+
It defaults to strict mode, rejecting every standard violation. Tolerant and
|
|
11
|
+
forensic modes accept only supported rules with `repairApplied: true`, which
|
|
12
|
+
attests that the adapter performed and verified the exact `action` exposed by
|
|
13
|
+
`GPU_MODEL_REPAIR_RULES`. It does **not** parse a model or perform repairs.
|
|
14
|
+
Continue to validate the repaired document with `validateGpuModelDocument`.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { evaluateGpuModelDiagnostics } from "@plasius/gpu-model-core";
|
|
18
|
+
|
|
19
|
+
const report = evaluateGpuModelDiagnostics({
|
|
20
|
+
standard: "gltf-glb",
|
|
21
|
+
mode: "tolerant",
|
|
22
|
+
issues: [{
|
|
23
|
+
kind: "violation",
|
|
24
|
+
ruleId: "missing-normals",
|
|
25
|
+
code: "NORMAL_REQUIRED",
|
|
26
|
+
path: "/meshes/0/primitives/0/attributes/NORMAL",
|
|
27
|
+
message: "Required normals were missing",
|
|
28
|
+
originalValue: null,
|
|
29
|
+
repairApplied: true, // Adapter already generated and validated normals.
|
|
30
|
+
}],
|
|
31
|
+
});
|
|
32
|
+
// report.accepted === true; report.repairs contains the complete repair record.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Blocking errors, repairs, unsupported data, warnings and loss are separate
|
|
36
|
+
`kind` variants. Unknown rules and unsupported data block every mode. Repairs
|
|
37
|
+
preserve `originalValue`, `action`, `severity`, `affectedPath`, `confidence`, and
|
|
38
|
+
`ruleId`. The supported profiles are `gltf-glb`, `obj-mtl`, `fbx`, and `cad-bim`;
|
|
39
|
+
OBJ cannot use the skin-weight repair rule. The exported policy text records
|
|
40
|
+
the upstream rule; executable contract actions deliberately narrow ambiguous
|
|
41
|
+
fallbacks: invalid primitives are dropped (never clamped), unavailable textures
|
|
42
|
+
remain unresolved, and malformed material references use the canonical default.
|
|
43
|
+
These three fallbacks require a `kind: "loss"` issue at the same path. Each loss
|
|
44
|
+
states `effect: "dropped" | "approximated"`; any loss blocks acceptance unless
|
|
45
|
+
`allowLoss: true` is explicitly supplied, including in strict mode.
|
|
46
|
+
|
|
47
|
+
Forensic mode requires `rawSource`, a relevant, scrubbed JSON snapshot. Other
|
|
48
|
+
modes reject that field to prevent unintended retention. Source evidence is
|
|
49
|
+
separate from ordinary diagnostics and remains available even when conversion
|
|
50
|
+
is rejected. Represent source NaN/Infinity as descriptive strings, not numbers.
|
|
51
|
+
Never include credentials, signed URLs or unrelated personal data, and never
|
|
52
|
+
log raw evidence or repair snapshots. The package performs no logging, I/O,
|
|
53
|
+
persistence or credential detection. Use serialized JSON as the boundary for
|
|
54
|
+
untrusted executable producers; JavaScript Proxies are not inert data.
|
|
55
|
+
|
|
56
|
+
`GPU_MODEL_DIAGNOSTIC_LIMITS` bounds the entire input to 1 MiB of JSON UTF-8,
|
|
57
|
+
4096 issues, 16384 JSON values, depth 12, 1024 members per evidence container
|
|
58
|
+
and 65536 UTF-16 units per string. All ceilings apply together. Optional
|
|
59
|
+
`maxEvidenceBytes` lowers the aggregate byte ceiling, including report fields
|
|
60
|
+
and the limit itself. Overflow, unknown keys, getters, cycles, sparse arrays,
|
|
61
|
+
exotic objects and malformed reports throw a static `GpuModelDiagnosticsError`
|
|
62
|
+
without echoing caller data. Successful output is deeply frozen and owned by
|
|
63
|
+
the package; caller objects remain mutable and unchanged.
|
|
64
|
+
|
|
65
|
+
The parent `gpu.model.conversion.enabled` flag governs adapter adoption. Keep
|
|
66
|
+
it disabled until adapter-specific conformance tests pass; rollback disables
|
|
67
|
+
the flag and restores strict mode. This API changes no stored flag and adds no
|
|
68
|
+
UI capability. Synthetic contract fixtures cover glTF, OBJ, FBX and CAD reports;
|
|
69
|
+
actual parsing and geometry verification belong to their format adapters.
|
|
70
|
+
See [ADR-0008](docs/adrs/adr-0008-bounded-adapter-diagnostics-and-repair-ledgers.md).
|
|
71
|
+
|
|
7
72
|
## Implementation tracker
|
|
8
73
|
|
|
9
74
|
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:
|