@forgeax/engine-pack 0.1.2
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/LICENSE +202 -0
- package/README.md +370 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts +2 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-path.test.d.ts +2 -0
- package/dist/__tests__/artifact-path.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts +2 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts +2 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli.unit.test.d.ts +2 -0
- package/dist/__tests__/cli.unit.test.d.ts.map +1 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-asset-config.test.d.ts +2 -0
- package/dist/__tests__/load-asset-config.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts +2 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts.map +1 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts +2 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts.map +1 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts +2 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts +2 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts.map +1 -0
- package/dist/__tests__/pack.unit.test.d.ts +2 -0
- package/dist/__tests__/pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts +2 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts +2 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts +2 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology.unit.test.d.ts +2 -0
- package/dist/__tests__/topology.unit.test.d.ts.map +1 -0
- package/dist/artifact-path.d.ts +9 -0
- package/dist/artifact-path.d.ts.map +1 -0
- package/dist/atlas/run-atlas.d.ts +8 -0
- package/dist/atlas/run-atlas.d.ts.map +1 -0
- package/dist/atlas/shelf-pack.d.ts +55 -0
- package/dist/atlas/shelf-pack.d.ts.map +1 -0
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.mjs +3 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/builtin.d.ts +24 -0
- package/dist/builtin.d.ts.map +1 -0
- package/dist/cli-asset.d.ts +22 -0
- package/dist/cli-asset.d.ts.map +1 -0
- package/dist/cli-asset.mjs +9950 -0
- package/dist/cli-asset.mjs.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.mjs +29 -0
- package/dist/config.mjs.map +1 -0
- package/dist/deriveAssetName.d.ts +15 -0
- package/dist/deriveAssetName.d.ts.map +1 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.mjs +19 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/evidence/material-cook.d.ts +70 -0
- package/dist/evidence/material-cook.d.ts.map +1 -0
- package/dist/evidence/offline-evidence.d.ts +25 -0
- package/dist/evidence/offline-evidence.d.ts.map +1 -0
- package/dist/evidence/source-inventory.d.ts +29 -0
- package/dist/evidence/source-inventory.d.ts.map +1 -0
- package/dist/guid.d.ts +45 -0
- package/dist/guid.d.ts.map +1 -0
- package/dist/guid.mjs +94 -0
- package/dist/guid.mjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +8475 -0
- package/dist/index.mjs.map +1 -0
- package/dist/material/artifact-writer.d.ts +14 -0
- package/dist/material/artifact-writer.d.ts.map +1 -0
- package/dist/mesh-bin-contract.d.ts +36 -0
- package/dist/mesh-bin-contract.d.ts.map +1 -0
- package/dist/name.mjs +22 -0
- package/dist/name.mjs.map +1 -0
- package/dist/native-cooker-registry.d.ts +28 -0
- package/dist/native-cooker-registry.d.ts.map +1 -0
- package/dist/native-cooker.d.ts +3 -0
- package/dist/native-cooker.d.ts.map +1 -0
- package/dist/native-cooker.mjs +105 -0
- package/dist/native-cooker.mjs.map +1 -0
- package/dist/producer-contract.d.ts +19 -0
- package/dist/producer-contract.d.ts.map +1 -0
- package/dist/resolve-asset-source.d.ts +4 -0
- package/dist/resolve-asset-source.d.ts.map +1 -0
- package/dist/resolve-asset-source.mjs +99 -0
- package/dist/resolve-asset-source.mjs.map +1 -0
- package/dist/runtime-projection.d.ts +14 -0
- package/dist/runtime-projection.d.ts.map +1 -0
- package/dist/scanner.d.ts +80 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.mjs +9015 -0
- package/dist/scanner.mjs.map +1 -0
- package/dist/schema-compiled.d.ts +12 -0
- package/dist/schema-compiled.d.ts.map +1 -0
- package/dist/schema.mjs +7369 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/scriptable-pack-node.d.ts +67 -0
- package/dist/scriptable-pack-node.d.ts.map +1 -0
- package/dist/scriptable-pack-node.mjs +1590 -0
- package/dist/scriptable-pack-node.mjs.map +1 -0
- package/dist/scriptable-pack-worker.d.ts +2 -0
- package/dist/scriptable-pack-worker.d.ts.map +1 -0
- package/dist/scriptable-pack-worker.mjs +223 -0
- package/dist/scriptable-pack-worker.mjs.map +1 -0
- package/dist/scriptable-pack.d.ts +525 -0
- package/dist/scriptable-pack.d.ts.map +1 -0
- package/dist/scriptable-pack.mjs +583 -0
- package/dist/scriptable-pack.mjs.map +1 -0
- package/dist/topology.d.ts +10 -0
- package/dist/topology.d.ts.map +1 -0
- package/package.json +129 -0
- package/schema/meta.schema.json +173 -0
- package/schema/pack.schema.json +232 -0
- package/src/__tests__/ai-recovery.unit.test.ts +114 -0
- package/src/__tests__/artifact-path.test.ts +41 -0
- package/src/__tests__/asset-evidence-error-hints.test.ts +46 -0
- package/src/__tests__/asset-evidence-lifecycle.test.ts +104 -0
- package/src/__tests__/asset-evidence-schema.test.ts +86 -0
- package/src/__tests__/atlas-cli-region-mismatch.test.ts +134 -0
- package/src/__tests__/atlas-error-code-owner.test-d.ts +23 -0
- package/src/__tests__/cli-asset-evidence.integration.test.ts +172 -0
- package/src/__tests__/cli.unit.test.ts +448 -0
- package/src/__tests__/evidence-source-inventory.unit.test.ts +37 -0
- package/src/__tests__/guid-collision.unit.test.ts +112 -0
- package/src/__tests__/guid-validator-surface.unit.test.ts +20 -0
- package/src/__tests__/load-asset-config.test.ts +121 -0
- package/src/__tests__/material-cook-dependencies.unit.test.ts +45 -0
- package/src/__tests__/material-cook-receipt.unit.test.ts +91 -0
- package/src/__tests__/material-cook-schema.unit.test.ts +98 -0
- package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +21 -0
- package/src/__tests__/mesh-bin-contract.unit.test.ts +32 -0
- package/src/__tests__/meta-schema-optional.test.ts +116 -0
- package/src/__tests__/meta-source-overrides.unit.test.ts +71 -0
- package/src/__tests__/native-cooker-registry.test.ts +64 -0
- package/src/__tests__/offline-evidence-artifact-verification-owner.test-d.ts +64 -0
- package/src/__tests__/offline-evidence.integration.test.ts +106 -0
- package/src/__tests__/pack-v2-fixture-migration.test.ts +64 -0
- package/src/__tests__/pack-v2-schema.test.ts +142 -0
- package/src/__tests__/pack.unit.test.ts +2218 -0
- package/src/__tests__/producer-contract-schema.unit.test.ts +92 -0
- package/src/__tests__/resolve-asset-source.test.ts +121 -0
- package/src/__tests__/runtime-projection.unit.test.ts +87 -0
- package/src/__tests__/scanner-inventory.test.ts +72 -0
- package/src/__tests__/scanner-mount-cycle.test.ts +232 -0
- package/src/__tests__/scriptable-pack-cli.integration.test.ts +47 -0
- package/src/__tests__/scriptable-pack-ddc-key.unit.test.ts +63 -0
- package/src/__tests__/scriptable-pack.test-d.ts +131 -0
- package/src/__tests__/scriptable-pack.unit.test.ts +747 -0
- package/src/__tests__/topology-actions.unit.test.ts +94 -0
- package/src/__tests__/topology.unit.test.ts +85 -0
- package/src/artifact-path.ts +69 -0
- package/src/atlas/run-atlas.ts +358 -0
- package/src/atlas/shelf-pack.ts +176 -0
- package/src/atlas/upng-ambient.d.ts +13 -0
- package/src/bridge.ts +2 -0
- package/src/builtin.ts +79 -0
- package/src/cli-asset.ts +590 -0
- package/src/config.ts +36 -0
- package/src/deriveAssetName.ts +42 -0
- package/src/errors.ts +47 -0
- package/src/evidence/material-cook.ts +332 -0
- package/src/evidence/offline-evidence.ts +90 -0
- package/src/evidence/source-inventory.ts +193 -0
- package/src/guid.ts +99 -0
- package/src/index.ts +104 -0
- package/src/material/artifact-writer.ts +26 -0
- package/src/mesh-bin-contract.ts +150 -0
- package/src/native-cooker-registry.ts +163 -0
- package/src/native-cooker.ts +2 -0
- package/src/producer-contract.ts +277 -0
- package/src/resolve-asset-source.ts +93 -0
- package/src/runtime-projection.ts +100 -0
- package/src/scanner.ts +716 -0
- package/src/schema/material-cook.schema.json +79 -0
- package/src/schema-compiled.ts +238 -0
- package/src/scriptable-pack-node.ts +1390 -0
- package/src/scriptable-pack-worker.ts +306 -0
- package/src/scriptable-pack.ts +884 -0
- package/src/topology.ts +156 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# @forgeax/engine-pack
|
|
2
|
+
|
|
3
|
+
## MaterialAsset 唯一成功路径
|
|
4
|
+
|
|
5
|
+
Pack 承载 `paramSchema -> derive -> compile/reflect -> cook/load -> extract/record`
|
|
6
|
+
中的 cook/load 边界:producer 先发布含 `coordinateSet`、transform、
|
|
7
|
+
`physicalUvScale`、artifact 与 `layoutIdentity` 的 receipt,再由 catalog 按 GUID
|
|
8
|
+
提供给 runtime。identity 或 receipt 过期时 inspect producer evidence,修复后
|
|
9
|
+
recook 并重新验证,不手改 cooked payload。
|
|
10
|
+
|
|
11
|
+
> [!IMPORTANT]
|
|
12
|
+
> Pack 是发布与证据边界,不是第二份 schema;恢复动作依赖结构化状态与 receipt,
|
|
13
|
+
> 并沿 producer owner 回到源输入。
|
|
14
|
+
|
|
15
|
+
## Authoring and recovery index
|
|
16
|
+
|
|
17
|
+
## Mesh binary v4 boundary
|
|
18
|
+
|
|
19
|
+
Mesh artifacts use one canonical `geometry` projection and one strict wire
|
|
20
|
+
contract. The pack package owns the header facts and digest implementation in
|
|
21
|
+
[`src/mesh-bin-contract.ts`](src/mesh-bin-contract.ts); consumers must not
|
|
22
|
+
recreate that table.
|
|
23
|
+
|
|
24
|
+
| Fact | Owner | Recovery |
|
|
25
|
+
|:--|:--|:--|
|
|
26
|
+
| projection mask, schema version, stride, digest | `@forgeax/engine-geometry` + pack contract | Re-cook from source and Meta |
|
|
27
|
+
| vertex/index cardinality and payload bounds | build-time import producer | Repair source payload, then cold-cook |
|
|
28
|
+
| malformed or legacy mesh binary | strict runtime loader | Keep LKG; publish only a fully validated replacement |
|
|
29
|
+
|
|
30
|
+
> [!WARNING]
|
|
31
|
+
> Mesh binary v4 is the only accepted/emitted mesh wire version. v2/v3 are
|
|
32
|
+
> rejected closed; runtime never decodes or re-cooks a legacy payload.
|
|
33
|
+
|
|
34
|
+
## ScriptablePack in 30 seconds
|
|
35
|
+
|
|
36
|
+
The public happy path is: declare GUIDs in a `*.pack.ts`, run the Vite Pack
|
|
37
|
+
producer, publish Pack v2 plus the Catalog, then call
|
|
38
|
+
`AssetRegistry.load(guid, kind)`. The durable consumer matrix is the exported
|
|
39
|
+
`SCRIPTABLE_PACK_ASSET_KINDS` list: mesh, material, scene, texture, equirect,
|
|
40
|
+
sampler, font, render-pipeline, tileset, video, skeleton, skin,
|
|
41
|
+
animation-clip, animation-graph, audio, and particle-effect.
|
|
42
|
+
|
|
43
|
+
Every successful row keeps its `sourceKey` identity, dependency `refs`, and
|
|
44
|
+
producer-owned `artifacts`. Audio keeps `mediaType` and bytes; particle effects
|
|
45
|
+
keep `programFingerprint` and the cooked program. Animation and tile consumers
|
|
46
|
+
turn a loaded payload into a World-owned shared reference at their own boundary.
|
|
47
|
+
|
|
48
|
+
For failure, switch on `code`, inspect `expected`, `hint`, and narrowed `detail`:
|
|
49
|
+
repair the definition or producer, rebuild/cold-cook, refresh the Catalog LKG,
|
|
50
|
+
or attach the missing Host capability. A missing audio/video/VFX capability is
|
|
51
|
+
an install/play/execute error, not a durable-load error. The machine contract
|
|
52
|
+
lives in [`pack.schema.json`](schema/pack.schema.json) and
|
|
53
|
+
[`meta.schema.json`](schema/meta.schema.json); this section is guidance, not a
|
|
54
|
+
second manifest.
|
|
55
|
+
|
|
56
|
+
The machine contract is [`asset-authority.schema.json`](../../asset-authority.schema.json). The audit gate is [`check-asset-authority-audit.mjs`](../../scripts/forgeax/check-asset-authority-audit.mjs); it reports subject, execution, author authority, runtime source, lifecycle, owner, producer, and sourceKey evidence for every named category.
|
|
57
|
+
|
|
58
|
+
The staged route is explicit: `author-validation` -> `external-declaration` ->
|
|
59
|
+
`import` -> `native-cook` -> `ddc-validation` -> `runtime-parse` ->
|
|
60
|
+
`editor-capability`. Each stage keeps its own evidence; a cache hit does not
|
|
61
|
+
replace author authority, and an Editor capability does not become a runtime
|
|
62
|
+
source.
|
|
63
|
+
|
|
64
|
+
| Need | Entry | Safe action |
|
|
65
|
+
|:--|:--|:--|
|
|
66
|
+
| Inspect one asset | `forgeax-engine-remote-asset lookup --guid ... --project ... --catalog ... --json` | Read structured evidence and diagnostics |
|
|
67
|
+
| Verify a result | `forgeax-engine-remote-asset verify --guid ... --project ... --catalog ... --json` | Repair the producer or package, then retry |
|
|
68
|
+
| Rebuild a cooked result | Pack/import runner and the declared producer | Cold cook after discarding invalid DDC |
|
|
69
|
+
| Preview old output | Catalog evidence with explicit last-known-good state | Preview only; never publish it as current |
|
|
70
|
+
|
|
71
|
+
Pack or external source plus Meta owns author facts. DDC and Catalog are derived projections; they are not author databases or write authorities.
|
|
72
|
+
|
|
73
|
+
> [!IMPORTANT]
|
|
74
|
+
> The pack contract has one material authoring shape: a `MaterialAsset` payload. The cook stage resolves inheritance, values, texture coordinates, module references, artifact bytes, and a receipt into one record. Runtime consumers use the GUID and catalog locator; they do not author a second shader resource.
|
|
75
|
+
|
|
76
|
+
## MaterialAsset cook contract
|
|
77
|
+
|
|
78
|
+
Put the material payload in the package `assets[]` row and keep its `refs[]` graph complete. The `passes`, `values`, `parent`, and texture `coordinates` remain one authored route. A valid cooked material record contains `resolved`, `refs`, `artifact`, and `receipt`. If any part is absent, recover by fixing the producer payload or re-running the cook; this is the recovery route. Then repeat `lookup/verify --guid --project --catalog --json`.
|
|
79
|
+
|
|
80
|
+
当 `parameters` 将字段声明为 `texture` 时,`values` 可保留纹理 GUID 字符串简写;省略
|
|
81
|
+
`parameters` 的默认材质也只对 `MATERIAL_TEXTURE_SLOTS` 中的纹理槽启用该简写。只有
|
|
82
|
+
sampler、强度或非默认坐标等附加元数据才使用结构化纹理对象。坐标字段的省略由运行时
|
|
83
|
+
统一解析为 identity,但 cook/load 不得把 identity 坐标自动展开并写回创作 payload。
|
|
84
|
+
|
|
85
|
+
> [!IMPORTANT]
|
|
86
|
+
> The producer publishes facts; the consumer does not guess. `packageId`,
|
|
87
|
+
> `provenance`, `revision`, `sourceKey`, relations, and diagnostics survive
|
|
88
|
+
> package moves and DDC relocation. Paths and array positions are locators,
|
|
89
|
+
> not identities.
|
|
90
|
+
|
|
91
|
+
Disk schema, GUID tools (`AssetGuid` brand + UUIDv7/v5), mesh-binary wire facts, and scanner fail-fast chain (13-member `PackErrorCode`) for the forgeax engine asset package system. The three CLI surfaces -- `scan`, `lookup`, `verify` -- are shipped as the standalone plugin bin `forgeax-engine-remote-asset` (resolved via PATH-prefix discovery for `forgeax-engine-remote-`; filesystem-mode; offline; no WS connection required).
|
|
92
|
+
|
|
93
|
+
> Package name vs directory: this package is published as `@forgeax/engine-pack` but lives at `packages/pack` on disk. The `@forgeax/engine-` prefix is the IDE-autocomplete entrypoint AI users discover the package family by; the directory drops the prefix to keep tree depth flat (mirrors the `packages/runtime` / `@forgeax/engine-runtime` pair). All other packages in the engine family follow the same convention.
|
|
94
|
+
|
|
95
|
+
## AssetEvidence: the offline proof chain
|
|
96
|
+
|
|
97
|
+
Pack owns the offline half of the GUID evidence chain: `source inventory -> catalog packageUrl/cookReceiptUrl -> producer CookReceipt -> Pack v2 package and artifact verification -> AssetEvidence`.
|
|
98
|
+
|
|
99
|
+
The catalog is a locator, not proof. `lookup/verify --guid --project --catalog --json` joins the source meta or authored pack, the catalog row, the receipt, and the package descriptors. Both commands emit one JSON record on stdout or one structured `{code, expected, hint, detail}` record on stderr; there is no runtime or WebSocket dependency.
|
|
100
|
+
|
|
101
|
+
## VFX Pack v2 migration
|
|
102
|
+
|
|
103
|
+
VFX source v2 is cooked in one atomic producer step. The executable contract is
|
|
104
|
+
`scripts/asset-cook-contract.mjs`; a package-local scripts path is not valid.
|
|
105
|
+
The cook publishes the Pack payload and
|
|
106
|
+
`particle-effect/program.json` with the same source fingerprint. Runtime loads
|
|
107
|
+
the GUID-indexed artifact and never compiles author WGSL.
|
|
108
|
+
|
|
109
|
+
When adding a Batch B renderer, update the source declaration, explicit material
|
|
110
|
+
or mesh refs, native-cook catalog, and receipt together. Re-run `lookup` and
|
|
111
|
+
`verify`; stale output is repaired by the owning importer or native cooker, not
|
|
112
|
+
by a demo-side mesh substitute.
|
|
113
|
+
|
|
114
|
+
`notCooked` means a source declaration has no successful receipt. `ready/current` means the receipt fingerprint matches the source; `ready/stale` means it does not. `unknown` is reserved for missing evidence. Artifact and package status remain `notChecked`, `passed`, or `failed`; a historical receipt never upgrades an unchecked package.
|
|
115
|
+
|
|
116
|
+
Build-time importers write source meta and producer receipts; the Vite plugin publishes the locator. Runtime packages consume the resulting Pack v2 bytes and must not import this Node-only evidence adapter. See [`packages/types/src/asset-evidence.ts`](../types/src/asset-evidence.ts) for the exact schema and closed errors.
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
### ScriptablePack source
|
|
121
|
+
|
|
122
|
+
Use `@forgeax/engine-pack/source` when one trusted TypeScript source declares and builds a multi-asset package. The definition owns `packageId`, every output `guid`, `sourceKey`, `kind`, and optional display `name`. `build(reader)` returns ordinary typed Assets keyed by the same `sourceKey` set; it cannot publish, mutate Catalog, or mint identity.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import type { ScriptablePackDefinition } from '@forgeax/engine-pack/source';
|
|
126
|
+
|
|
127
|
+
export default {
|
|
128
|
+
schemaVersion: '1.0.0',
|
|
129
|
+
packageId,
|
|
130
|
+
assets: {
|
|
131
|
+
mesh: { guid: meshGuid, kind: 'mesh', name: 'Generated Mesh' },
|
|
132
|
+
scene: { guid: sceneGuid, kind: 'scene', name: 'Generated Scene' },
|
|
133
|
+
},
|
|
134
|
+
externalAssets: { material: materialGuid },
|
|
135
|
+
build: async (assets) => ({ ok: true, value: { mesh, scene } }),
|
|
136
|
+
} satisfies ScriptablePackDefinition;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`forgeax-engine-remote-asset meta <source.pack.ts> --json` executes module initialization, validates the default export, and projects canonical Meta without calling `build`. `@forgeax/engine-pack/source-node` accepts a host executor with `load` and optional `dispose`; `timeoutMs` bounds module initialization and `buildTimeoutMs` bounds one `build(reader)` call. A build timeout returns one structured `pack-source-load-failed` Result with `detail.phase: 'build'`, the configured `timeoutMs`, and deterministic cleanup of the isolated worker and compile root.
|
|
140
|
+
|
|
141
|
+
The default worker executes the complete relative TypeScript module closure on the supported Node floor, including Node 22 hosts that do not load `.ts` files directly. It transpiles that closure into a disposable ESM directory, resolves bare imports through the source project's nearest `node_modules`, and removes the directory when the worker is disposed. Bulk producers use the internal `createScriptablePackModuleExecutorPool()` with two recyclable workers; a pooled lease is released after metadata projection or one build, so a generation never retains one live Worker-backed definition per source.
|
|
142
|
+
|
|
143
|
+
> [!IMPORTANT]
|
|
144
|
+
> Source authoring is an explicit Node contract. Every gateway call carries a caller-minted `requestId`; mutations may carry `expectedRevision` for SHA-256 CAS. The filesystem port confines paths to one game root and atomically replaces only `canonical-v1` scaffolds. Arbitrary valid TypeScript remains inspectable and rebuildable, but unsupported structural edits fail closed with stable `pack-source-*` errors.
|
|
145
|
+
|
|
146
|
+
`SOURCE_AUTHORING_OPERATION_DESCRIPTORS` is the producer-owned structured capability manifest for tools. The existing `asset.preflight` operation returns the current revision, canonical Meta, incoming references, and shape-derived mutation capabilities before any write.
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { AssetGuid } from "@forgeax/engine-pack/guid";
|
|
150
|
+
import { scan, scanInventory } from "@forgeax/engine-pack/scanner";
|
|
151
|
+
|
|
152
|
+
// Runtime: resolve a known GUID at build time
|
|
153
|
+
const result = AssetGuid.parse("cbe42beb-8975-5096-b3a1-3dda4cb4c077");
|
|
154
|
+
if (!result.ok) throw result.error; // PackError with .code 'pack-guid-malformed'
|
|
155
|
+
const guid = result.value;
|
|
156
|
+
|
|
157
|
+
// Build / CI: validate an asset directory
|
|
158
|
+
const scanResult = await scan(["apps/hello/cube/assets"]);
|
|
159
|
+
if (!scanResult.ok) throw scanResult.error; // PackError with .code/.hint/.detail
|
|
160
|
+
console.log(scanResult.value); // PackEntry[]
|
|
161
|
+
|
|
162
|
+
// Build hosts can retain one validated inventory and project paths from it.
|
|
163
|
+
const inventory = await scanInventory(["apps/hello/cube/assets"]);
|
|
164
|
+
if (!inventory.ok) throw inventory.error;
|
|
165
|
+
console.log(inventory.value.paths, inventory.value.scriptablePackMeta);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Schema shapes
|
|
169
|
+
|
|
170
|
+
Two sidecar JSON files live next to each source file in an asset directory:
|
|
171
|
+
|
|
172
|
+
### `.meta.json` -- external-asset-package
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"schemaVersion": "1.0.0",
|
|
177
|
+
"kind": "external-asset-package",
|
|
178
|
+
"importer": "gltf",
|
|
179
|
+
"source": "<source-filename>",
|
|
180
|
+
"importSettings": {},
|
|
181
|
+
"subAssets": [
|
|
182
|
+
{ "guid": "<UUIDv7-or-UUIDv5>", "sourceIndex": 0, "kind": "mesh", "compression": "zstd" }
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
> [!NOTE]
|
|
187
|
+
> `compression?: 'none' | 'zstd'` on `PackIndexEntry` (and `subAssets[].compression`)
|
|
188
|
+
> indicates whether the asset's `.bin` is zstd-compressed. See
|
|
189
|
+
> `@forgeax/engine-codec` README for the full codec API and error codes.
|
|
190
|
+
> Runtime `fetchBinary` transparently decompresses when this field is `'zstd'`.
|
|
191
|
+
>
|
|
192
|
+
> **Declaring compression intent (AC-01):** set `importSettings.compression`
|
|
193
|
+
> (`'none' | 'zstd'`) to override the build-time default strategy for this asset
|
|
194
|
+
> (default: mesh -> `zstd`, texture -> `none`; `.pack.json` never compressed).
|
|
195
|
+
> The importer honors the override and writes the resulting `compression` onto
|
|
196
|
+
> the output catalog row. Omit it to accept the kind-keyed default.
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `.pack.json` -- internal-text-package
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"schemaVersion": "1.0.0",
|
|
204
|
+
"kind": "internal-text-package",
|
|
205
|
+
"assets": [
|
|
206
|
+
{
|
|
207
|
+
"guid": "<UUIDv7-or-UUIDv5>",
|
|
208
|
+
"kind": "mesh",
|
|
209
|
+
"payload": {},
|
|
210
|
+
"refs": []
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Producer provenance and topology
|
|
217
|
+
|
|
218
|
+
Both package schemas accept producer-owned `packageId`, `provenance`,
|
|
219
|
+
`revision`, and structured `diagnostics`. Asset/output rows may declare a
|
|
220
|
+
stable `sourceKey`; `sourceIndex` is positional evidence only. The runtime
|
|
221
|
+
function `diffTopology(previous, next)` (also exported as
|
|
222
|
+
`calculateTopologyDiff`) preserves GUIDs by `sourceKey`, reports additions,
|
|
223
|
+
removals, and kind changes, and marks multi-output source-index-only matching
|
|
224
|
+
as ambiguous.
|
|
225
|
+
|
|
226
|
+
| Fact | Published by | Consumer rule |
|
|
227
|
+
|:--|:--|:--|
|
|
228
|
+
| `packageId` | Producer declaration | Keep stable across path or URL relocation |
|
|
229
|
+
| `provenance` | Producer declaration | Copy without replacing it with importer guesses |
|
|
230
|
+
| `revision` | Producer/DDC | Use to detect stale updates; do not silently overwrite a verified snapshot |
|
|
231
|
+
| `sourceKey` | Imported-output producer | Match topology only when the producer supplies a stable semantic key |
|
|
232
|
+
| `sourceIndex` | Imported-output producer | Display or inspect position; never use it as identity |
|
|
233
|
+
| `relations` / `diagnostics` | Producer facts | Preserve the complete structured values |
|
|
234
|
+
|
|
235
|
+
> [!WARNING]
|
|
236
|
+
> A missing `sourceKey` in a multi-output declaration is evidence insufficiency,
|
|
237
|
+
> not permission to hash a path or promote `sourceIndex`. Keep the result
|
|
238
|
+
> ambiguous and expose the repair hint.
|
|
239
|
+
|
|
240
|
+
The DDC path is also lossless: the import runner copies package-level facts to
|
|
241
|
+
the `.pack.json` envelope and copies each declared output's `sourceKey`,
|
|
242
|
+
`sourceIndex`, and relations onto the matching GUID row. The catalog builder
|
|
243
|
+
then projects those rows into `PackIndexEntry`; it does not create a second
|
|
244
|
+
authoritative fact store.
|
|
245
|
+
|
|
246
|
+
### MaterialAsset shape -- pass-based material in `.pack.json`
|
|
247
|
+
|
|
248
|
+
When `kind: 'material'`, the `payload` object carries `passes[]` + `values` (feat-20260527-material-registration-unification M3).
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"guid": "<UUIDv7>",
|
|
253
|
+
"kind": "material",
|
|
254
|
+
"payload": {
|
|
255
|
+
"kind": "material",
|
|
256
|
+
"passes": [
|
|
257
|
+
{
|
|
258
|
+
"name": "Forward",
|
|
259
|
+
"program": { "module": "forgeax::default-standard-pbr" }
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
"values": {
|
|
263
|
+
"baseColor": [1.0, 0.8, 0.2],
|
|
264
|
+
"metallic": 0.3
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"refs": []
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**MaterialAsset fields in pack.json**:
|
|
272
|
+
|
|
273
|
+
| Field | Type | Description |
|
|
274
|
+
|:--|:--|:--|
|
|
275
|
+
| `passes` | `MaterialPass[]` | Root pass descriptors; each pass names a `program.module`. |
|
|
276
|
+
| `parameters` | `MaterialParameter[]` | Root parameter contract used by cook and reflection. |
|
|
277
|
+
| `values` | `Record<string, unknown>` | Child-owned values, including per-slot texture coordinates. |
|
|
278
|
+
| `parent` | `AssetGuid` | Optional serialized parent edge. |
|
|
279
|
+
|
|
280
|
+
**Validation** is performed by the material schema and build-time cook. The cook resolves the parent chain, validates values and pass programs, and emits the effective record, artifact, references, and receipt. Runtime reports a structured missing-cook error instead of compiling a material.
|
|
281
|
+
|
|
282
|
+
## `AssetGuid` API
|
|
283
|
+
|
|
284
|
+
| Function | Signature | Description |
|
|
285
|
+
|:--|:--|:--|
|
|
286
|
+
| `AssetGuid.parse` | `(input: string) => Result<AssetGuid, PackError>` | Parse dash-separated UUID string; returns `Ok(AssetGuid)` on success or `Err(PackError{code:'pack-guid-malformed'})` on failure. Never throws. |
|
|
287
|
+
| `AssetGuid.format` | `(guid: AssetGuid) => string` | Format as lowercase dash-separated UUID string |
|
|
288
|
+
| `AssetGuid.equals` | `(a: AssetGuid, b: AssetGuid) => boolean` | Constant-time equality |
|
|
289
|
+
| `AssetGuid.random` | `() => AssetGuid` | Generate a random UUIDv7 GUID |
|
|
290
|
+
| `deriveBuiltin` | `(name: string) => Promise<AssetGuid>` | Derive a deterministic UUIDv5 from a name within the ForgeaX namespace; async (SHA-1 via Web Crypto or node:crypto) |
|
|
291
|
+
|
|
292
|
+
## `PackErrorCode` -- 13-member closed union
|
|
293
|
+
|
|
294
|
+
Exhaustive `switch (err.code)` without `default` -- TS guards completeness.
|
|
295
|
+
|
|
296
|
+
| Code | `err.detail` shape |
|
|
297
|
+
|:--|:--|
|
|
298
|
+
| `pack-malformed-meta` | `{ path: string; ajvErrors: string[] }` |
|
|
299
|
+
| `pack-malformed-pack` | `{ path: string; ajvErrors: string[] }` |
|
|
300
|
+
| `pack-guid-malformed` | `{ raw: string; reason: string }` |
|
|
301
|
+
| `pack-orphan-meta` | `{ metaPath: string; expectedFile: string }` |
|
|
302
|
+
| `pack-meta-missing` | `{ sourcePath: string; expectedMetaPath: string }` |
|
|
303
|
+
| `pack-guid-collision` | `{ guid: string; paths: [string, string] }` |
|
|
304
|
+
| `pack-cyclic-reference` | `{ code; kind: 'childof' \| 'mount-asset'; cycle: string[] }` -- first and last element repeated; `kind` distinguishes runtime ChildOf cycle from build-time mount-asset cycle (R10) |
|
|
305
|
+
| `pack-subasset-index-out-of-range` | `{ metaPath: string; sourceIndex: number; maxIndex: number }` |
|
|
306
|
+
| `payload-schema-mismatch` | `{ guid: string; errors: { instancePath: string; message: string }[] }` -- material payload failed `buildMaterialAssetValidator` check (scanner step-7) |
|
|
307
|
+
| `pack-mount-localid-overlap` | `{ overlapping: number[]; sources: string[] }` -- mount memberFirst windows collide |
|
|
308
|
+
| `pack-mount-count-mismatch` | `{ mountLocalId; declared; actual }` -- mount.memberCount disagrees with referenced child SceneAsset.entities.length |
|
|
309
|
+
| `pack-mount-override-localid-out-of-range` | `{ overrideLocalId; mountLocalId; memberCount }` -- override.localId outside mount window |
|
|
310
|
+
| `pack-mount-override-unknown-field` | `{ comp; field; mountLocalId }` -- override.comp / override.field unknown to schema vocab |
|
|
311
|
+
|
|
312
|
+
Access `err.detail.<field>` directly after narrowing via `switch (err.code)` -- full IDE autocomplete.
|
|
313
|
+
|
|
314
|
+
## CLI plugin -- `forgeax-engine-remote-asset`
|
|
315
|
+
|
|
316
|
+
The CLI subcommands ship as a standalone plugin bin `forgeax-engine-remote-asset` (entry `dist/cli-asset.mjs`) declared in this package's `package.json#bin`, discovered via PATH-prefix scan for `forgeax-engine-remote-`.
|
|
317
|
+
|
|
318
|
+
| Subcommand | Description | Exit code |
|
|
319
|
+
|:--|:--|:--|
|
|
320
|
+
| `forgeax-engine-remote-asset scan [--roots <dir>...]` | Print JSON array of all discovered `PackEntry` objects to stdout | 0 always |
|
|
321
|
+
| `forgeax-engine-remote-asset lookup <guid>` | Print matching `PackEntry` as JSON to stdout (cwd as scan root) | 0 found / 1 not found |
|
|
322
|
+
| `forgeax-engine-remote-asset verify [--strict]` | Run fail-fast 7-step scanner; print `PackError` JSON to stderr on first failure; prints `material-validated: <N>` count at end | 0 clean / 1 error |
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Direct invocation (after pnpm -F @forgeax/engine-pack build)
|
|
326
|
+
forgeax-engine-remote-asset scan --roots apps/hello/room/assets
|
|
327
|
+
forgeax-engine-remote-asset lookup 01935f3b-aaaa-7000-8000-000000000001
|
|
328
|
+
forgeax-engine-remote-asset verify --strict
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Scanner 7-step validation chain
|
|
332
|
+
|
|
333
|
+
The `verify` subcommand runs a fail-fast 7-step chain:
|
|
334
|
+
|
|
335
|
+
| Step | Check | Error code on failure |
|
|
336
|
+
|:--|:--|:--|
|
|
337
|
+
| 1 | Schema validation (`.meta.json` / `.pack.json` ajv) | `pack-malformed-meta` / `pack-malformed-pack` |
|
|
338
|
+
| 2 | GUID format check (UUIDv5/v7 dash format) | `pack-guid-malformed` |
|
|
339
|
+
| 3 | GUID collision detection (cross-file duplicate) | `pack-guid-collision` |
|
|
340
|
+
| 4 | Orphan `.meta.json` check (`.meta.json` without source file) | `pack-orphan-meta` |
|
|
341
|
+
| 5 | Missing `.meta.json` check (source file without sidecar) | `pack-meta-missing` |
|
|
342
|
+
| 6 | Subasset index bounds check (`.meta.json` subAssets[].sourceIndex) | `pack-subasset-index-out-of-range` |
|
|
343
|
+
| 7 | Material payload schema check (`buildMaterialAssetValidator(MATERIAL_PARAM_TYPES_V1)` for `kind: 'material'`) | `payload-schema-mismatch` |
|
|
344
|
+
|
|
345
|
+
## Mesh-binary artifact contract
|
|
346
|
+
|
|
347
|
+
`MESH_BIN_VERSION` and `MESH_BIN_HEADER_V4_BYTES` are the Pack-owned facts for
|
|
348
|
+
the v4 `<guid>.bin` mesh artifact. The header carries the geometry projection
|
|
349
|
+
version, attribute mask, stride, digest, cardinality, and payload byte lengths;
|
|
350
|
+
the import encoder and assets-runtime decoder consume those facts from the
|
|
351
|
+
package root. Independent test fixtures may keep literal header values only as
|
|
352
|
+
wire-format oracles, never as a second layout table.
|
|
353
|
+
|
|
354
|
+
> [!WARNING]
|
|
355
|
+
> v4 is the only accepted and emitted mesh-binary version. A v2/v3 artifact is
|
|
356
|
+
> a closed load error, not a compatibility input. Preserve the last-known-good
|
|
357
|
+
> catalog row, repair the source plus its `.meta.json` sidecar, then re-run the
|
|
358
|
+
> owning build-time importer/native cooker and `lookup/verify --guid --project
|
|
359
|
+
> --catalog --json` before publishing the replacement.
|
|
360
|
+
|
|
361
|
+
## Entry subpaths
|
|
362
|
+
|
|
363
|
+
| Subpath | Exports |
|
|
364
|
+
|:--|:--|
|
|
365
|
+
| `.` | Re-exports from all subpaths |
|
|
366
|
+
| `./schema` | Compiled ajv validators for `.meta.json` and `.pack.json` |
|
|
367
|
+
| `./guid` | `AssetGuid` brand type + `parse` (returns `Result`) / `format` / `equals` / `random` + async `deriveBuiltin(name)` |
|
|
368
|
+
| `./errors` | `PackError` class + `PackErrorCode` closed union + `PackErrorDetail` discriminated union |
|
|
369
|
+
| `./bridge` | `AssetRegistry` GUID bridge helpers |
|
|
370
|
+
| `./scanner` | File tree scanner with fail-fast 7-step validation chain |
|