@plasius/asset-contracts 0.4.6 → 0.6.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 +42 -0
- package/README.md +122 -0
- package/dist/index.cjs +1293 -954
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -1
- package/dist/index.d.ts +100 -1
- package/dist/index.js +1258 -935
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0009-model-resource-manifest-qualification.md +74 -0
- package/docs/adrs/adr-0010-public-conversion-diagnostics.md +61 -0
- package/docs/adrs/index.md +2 -0
- package/docs/tdrs/index.md +2 -0
- package/docs/tdrs/tdr-0004-model-resource-manifest-qualification.md +70 -0
- package/docs/tdrs/tdr-0005-public-conversion-diagnostics.md +51 -0
- package/package.json +3 -2
- package/src/index.ts +2 -0
- package/src/model-conversion-diagnostics.ts +185 -0
- package/src/model-resource-manifest.ts +198 -0
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,46 @@
|
|
|
14
14
|
- **Security**
|
|
15
15
|
- (placeholder)
|
|
16
16
|
|
|
17
|
+
## [0.6.0] - 2026-10-24
|
|
18
|
+
|
|
19
|
+
- **Added**
|
|
20
|
+
- Opt-in public-safe canonical conversion diagnostics with fixed codes/text,
|
|
21
|
+
resource/source identity, explicit loss/fallback evidence and legacy converter
|
|
22
|
+
projections. Reuses lazy model-core evaluation; independent approval and
|
|
23
|
+
promotion gates remain required.
|
|
24
|
+
- (placeholder)
|
|
25
|
+
|
|
26
|
+
- **Changed**
|
|
27
|
+
- (placeholder)
|
|
28
|
+
|
|
29
|
+
- **Fixed**
|
|
30
|
+
- (placeholder)
|
|
31
|
+
|
|
32
|
+
- **Security**
|
|
33
|
+
- (placeholder)
|
|
34
|
+
|
|
35
|
+
## [0.5.0] - 2026-10-24
|
|
36
|
+
|
|
37
|
+
- **Added**
|
|
38
|
+
- Opt-in canonical model resource manifest qualification with deterministic
|
|
39
|
+
file order, complete inventory/entrypoint checks, exact byte/hash/MIME
|
|
40
|
+
binding, bounded snapshots and cancellation/deadline handling. Existing
|
|
41
|
+
manifest factories remain compatible.
|
|
42
|
+
- (placeholder)
|
|
43
|
+
|
|
44
|
+
- **Changed**
|
|
45
|
+
- Add exact published `@plasius/gpu-model-core@0.7.0` for canonical public
|
|
46
|
+
inventory types; no runtime model parser import or other dependency update.
|
|
47
|
+
- (placeholder)
|
|
48
|
+
|
|
49
|
+
- **Fixed**
|
|
50
|
+
- (placeholder)
|
|
51
|
+
|
|
52
|
+
- **Security**
|
|
53
|
+
- Update development-only fast-uri from 3.1.8 to fixed 3.1.9 after the full
|
|
54
|
+
qualification audit reported URI-normalization advisories; retain major 3.
|
|
55
|
+
- (placeholder)
|
|
56
|
+
|
|
17
57
|
## [0.4.6] - 2026-10-23
|
|
18
58
|
|
|
19
59
|
- **Added**
|
|
@@ -307,3 +347,5 @@
|
|
|
307
347
|
[0.4.4]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.4.4
|
|
308
348
|
[0.4.5]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.4.5
|
|
309
349
|
[0.4.6]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.4.6
|
|
350
|
+
[0.5.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.5.0
|
|
351
|
+
[0.6.0]: https://github.com/Plasius-LTD/asset-contracts/releases/tag/v0.6.0
|
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ The exported surface covers:
|
|
|
27
27
|
helpers
|
|
28
28
|
- asset job metadata contracts
|
|
29
29
|
- manifest and file descriptor contracts
|
|
30
|
+
- opt-in canonical model package inventory and exact-byte qualification
|
|
31
|
+
- opt-in public-safe canonical conversion diagnostics and resource/source binding
|
|
30
32
|
- screenshot plan definitions
|
|
31
33
|
- review findings and review report contracts
|
|
32
34
|
- immutable promotion record contracts
|
|
@@ -45,6 +47,126 @@ The exported surface covers:
|
|
|
45
47
|
- generic manifest inference plus byte-verified typed promotion that preserves
|
|
46
48
|
specialized manifest fields
|
|
47
49
|
|
|
50
|
+
## Canonical Model Resource Qualification
|
|
51
|
+
|
|
52
|
+
`qualifyModelResourceManifest` binds an existing `AssetManifest` to a published
|
|
53
|
+
`@plasius/gpu-model-core` `ResourcePackageManifest` and the complete exported
|
|
54
|
+
file bytes. Existing factories retain their staged-construction behavior.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { qualifyModelResourceManifest } from "@plasius/asset-contracts";
|
|
58
|
+
|
|
59
|
+
// Obtain manifest, packageManifest and exportedFiles from your trusted pipeline.
|
|
60
|
+
const qualified = await qualifyModelResourceManifest({
|
|
61
|
+
manifest,
|
|
62
|
+
packageManifest,
|
|
63
|
+
files: exportedFiles, // [{ path, bytes: Uint8Array, contentType }]
|
|
64
|
+
signal: abortController.signal,
|
|
65
|
+
timeoutMs: 10_000,
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Every manifest path, canonical inventory path and payload path must correspond
|
|
70
|
+
exactly, including the entrypoint. The qualifier checks actual byte lengths and
|
|
71
|
+
SHA-256 digests, agreement of canonical MIME declarations, portable relative
|
|
72
|
+
POSIX paths, case-insensitive collisions and file/directory conflicts. Optional
|
|
73
|
+
inventory MIME declarations may be omitted; the descriptor and payload MIME
|
|
74
|
+
declarations are required. It preserves roles, sourceAdapter, source/derived
|
|
75
|
+
paths and specialized model metadata, returning frozen descriptors sorted by
|
|
76
|
+
locale-independent code-unit order. Typed model inputs are also revalidated by
|
|
77
|
+
`createModelAssetManifest`.
|
|
78
|
+
|
|
79
|
+
Pass ordinary `Uint8Array` values backed by `ArrayBuffer`; use
|
|
80
|
+
`new Uint8Array(nodeBuffer)` for Node buffers. Shared buffers, getters in
|
|
81
|
+
metadata, exotic records and sparse arrays are rejected. Metadata and bytes
|
|
82
|
+
are copied before the first hash. `MODEL_RESOURCE_MANIFEST_LIMITS` caps files
|
|
83
|
+
at 16,384, each file at 64 MiB, total bytes at 128 MiB, metadata depth at 16 and
|
|
84
|
+
metadata values at 262,144. Metadata strings are capped at 2,048 characters,
|
|
85
|
+
keys at 128, paths at 1,024 and MIME declarations at 128. The default deadline
|
|
86
|
+
is 10 seconds; callers may choose 1–60,000 ms. Cancellation and deadline checks
|
|
87
|
+
surround each bounded digest; Web Crypto cannot cancel an in-flight digest.
|
|
88
|
+
Failures use value-free `ModelResourceManifestError.code` values.
|
|
89
|
+
|
|
90
|
+
Embedded resources remain inside their owning entrypoint; list only actual
|
|
91
|
+
exported files. This helper checks bytes and declarations, not internal format
|
|
92
|
+
references, MIME sniffing, malware, rendering, storage or promotion authority.
|
|
93
|
+
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
|
|
96
|
+
is qualification at call time; callers must preserve the exact bytes in their
|
|
97
|
+
own immutable storage boundary.
|
|
98
|
+
|
|
99
|
+
The backend remote evaluator owns `gpu.model.conversion.enabled`. Call this
|
|
100
|
+
helper on the enabled adoption path; disabled and rollback paths retain the
|
|
101
|
+
existing factory path. The package performs no flag lookup or live mutation,
|
|
102
|
+
and adds no UI capability. The model-core dependency is exact published
|
|
103
|
+
`0.7.0` for public type compatibility; its import here is type-only, with no
|
|
104
|
+
runtime parser or renderer loading. Downstream adoption must use a released
|
|
105
|
+
package. See [ADR 0009](./docs/adrs/adr-0009-model-resource-manifest-qualification.md)
|
|
106
|
+
and [TDR 0004](./docs/tdrs/tdr-0004-model-resource-manifest-qualification.md).
|
|
107
|
+
|
|
108
|
+
## Public Conversion Diagnostics
|
|
109
|
+
|
|
110
|
+
`qualifyModelConversionDiagnostics` adds an opt-in, version-1 JSON boundary over
|
|
111
|
+
published model-core diagnostics. It reuses the canonical evaluator, loading it
|
|
112
|
+
only when this async helper is called. Existing factories remain compatible.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { qualifyModelConversionDiagnostics } from "@plasius/asset-contracts";
|
|
116
|
+
|
|
117
|
+
const result = await qualifyModelConversionDiagnostics({
|
|
118
|
+
outcome: "completed", // or "unsupported" / "failed" from your trusted adapter
|
|
119
|
+
source: publicSourceProvenance, // existing ModelProvenance; original source hash
|
|
120
|
+
report: canonicalDiagnosticInput, // model-core GpuModelDiagnosticInput
|
|
121
|
+
resources: [{ path: "/meshes/0", resource: publicModelResourceRef }],
|
|
122
|
+
}, { signal: abortController.signal, timeoutMs: 10_000 });
|
|
123
|
+
// Only these existing diagnostic/loss fields belong in ModelConverterEvidence:
|
|
124
|
+
const converterEvidence = { ...trustedConverterIdentity, ...result.converter };
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Every non-root diagnostic path must match exactly one supplied resource binding.
|
|
128
|
+
The root path `/` refers to `result.source`; no resource is fabricated. Resource
|
|
129
|
+
references use existing credential-free `mcp://models/...` contracts and include
|
|
130
|
+
hash, length and MIME identity. Conflicting references for one URI reject. These
|
|
131
|
+
bindings and provenance are caller assertions, not proof that bytes were read.
|
|
132
|
+
Use manifest qualification and independent promotion checks at their boundaries.
|
|
133
|
+
|
|
134
|
+
Statuses are derived deterministically: explicit failure wins, then unsupported
|
|
135
|
+
data/outcome, then canonical rejection, then warning or clean success. Loss
|
|
136
|
+
requires canonical explicit consent; denied loss produces blocking legacy loss
|
|
137
|
+
evidence. Only canonical accepted repairs receive a fallback rule id. Unknown
|
|
138
|
+
repair rules remain blocking. Arbitrary adapter codes, messages, private paths,
|
|
139
|
+
provider exceptions, original repair values and forensic rawSource are never
|
|
140
|
+
serialized; unknown adapter codes map to fixed category codes. Public codes are
|
|
141
|
+
`conversion.warning`, `conversion.repair`, `conversion.loss.dropped`,
|
|
142
|
+
`conversion.loss.approximated`, `conversion.unsupported`, `conversion.blocked`
|
|
143
|
+
and `conversion.failed`, with fixed bounded messages. Malformed input rejects
|
|
144
|
+
with value-free `ModelConversionDiagnosticsError.code`.
|
|
145
|
+
|
|
146
|
+
This projection is technical evidence only. `technicalAccepted` never replaces
|
|
147
|
+
human approval, malware/security, rights, fidelity, confirmation or promotion
|
|
148
|
+
receipts. `result.converter` contains the exact existing diagnostics/losses
|
|
149
|
+
shape; the detailed `result.diagnostics` additionally binds resources and
|
|
150
|
+
loss/fallback metadata. Preserve all independent evidence when composing it.
|
|
151
|
+
|
|
152
|
+
Inputs must be inert JSON records; getters, exotic prototypes, sparse arrays,
|
|
153
|
+
cycles, symbols and extra contract keys reject. Metadata is snapshotted before
|
|
154
|
+
awaiting. Fixed ceilings are 100 issues/resources, depth 12, 16,384 values,
|
|
155
|
+
2,048 characters per string and 262,144 total string characters. Non-completed
|
|
156
|
+
outcomes reserve one issue slot for a terminal diagnostic, so accept at most
|
|
157
|
+
99 issues. Arrays never exceed legacy 100-entry limits. Default deadline is
|
|
158
|
+
10 seconds, configurable from 1–60,000 ms; cancellation/deadlines bound the
|
|
159
|
+
lazy import wait and are checked around bounded synchronous evaluation. They
|
|
160
|
+
cannot preempt JavaScript evaluation or cancel the platform module loader.
|
|
161
|
+
No network, filesystem, logs, retries or persistent state are introduced.
|
|
162
|
+
|
|
163
|
+
Use the backend-evaluated `gpu.model.conversion.enabled` adoption decision;
|
|
164
|
+
disabled/rollback paths retain existing factories and diagnostics. No live flag
|
|
165
|
+
lookup/mutation or UI capability is added. The already-published exact
|
|
166
|
+
model-core0.7.0 dependency supplies evaluation without adding a parser or
|
|
167
|
+
renderer. No dependency version changes are needed. See [ADR 0010](./docs/adrs/adr-0010-public-conversion-diagnostics.md)
|
|
168
|
+
and [TDR 0005](./docs/tdrs/tdr-0005-public-conversion-diagnostics.md).
|
|
169
|
+
|
|
48
170
|
## Private Artifact Prevention
|
|
49
171
|
|
|
50
172
|
Signed contributor agreements and contributor acceptance records are retained
|