@forgeax/engine-pack 0.0.0-dev.8d955ade1c79

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.
Files changed (276) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +429 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__tests__/ai-recovery.unit.test.d.ts +2 -0
  5. package/dist/__tests__/ai-recovery.unit.test.d.ts.map +1 -0
  6. package/dist/__tests__/artifact-path.test.d.ts +2 -0
  7. package/dist/__tests__/artifact-path.test.d.ts.map +1 -0
  8. package/dist/__tests__/asset-evidence-error-hints.test.d.ts +2 -0
  9. package/dist/__tests__/asset-evidence-error-hints.test.d.ts.map +1 -0
  10. package/dist/__tests__/asset-evidence-lifecycle.test.d.ts +2 -0
  11. package/dist/__tests__/asset-evidence-lifecycle.test.d.ts.map +1 -0
  12. package/dist/__tests__/asset-evidence-schema.test.d.ts +2 -0
  13. package/dist/__tests__/asset-evidence-schema.test.d.ts.map +1 -0
  14. package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts +2 -0
  15. package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts.map +1 -0
  16. package/dist/__tests__/atlas-error-code-owner.test-d.d.ts +2 -0
  17. package/dist/__tests__/atlas-error-code-owner.test-d.d.ts.map +1 -0
  18. package/dist/__tests__/cli-asset-evidence.integration.test.d.ts +2 -0
  19. package/dist/__tests__/cli-asset-evidence.integration.test.d.ts.map +1 -0
  20. package/dist/__tests__/cli.unit.test.d.ts +2 -0
  21. package/dist/__tests__/cli.unit.test.d.ts.map +1 -0
  22. package/dist/__tests__/evidence-source-inventory.unit.test.d.ts +2 -0
  23. package/dist/__tests__/evidence-source-inventory.unit.test.d.ts.map +1 -0
  24. package/dist/__tests__/guid-collision.unit.test.d.ts +2 -0
  25. package/dist/__tests__/guid-collision.unit.test.d.ts.map +1 -0
  26. package/dist/__tests__/guid-validator-surface.unit.test.d.ts +2 -0
  27. package/dist/__tests__/guid-validator-surface.unit.test.d.ts.map +1 -0
  28. package/dist/__tests__/load-asset-config.test.d.ts +2 -0
  29. package/dist/__tests__/load-asset-config.test.d.ts.map +1 -0
  30. package/dist/__tests__/material-cook-dependencies.unit.test.d.ts +2 -0
  31. package/dist/__tests__/material-cook-dependencies.unit.test.d.ts.map +1 -0
  32. package/dist/__tests__/material-cook-receipt.unit.test.d.ts +2 -0
  33. package/dist/__tests__/material-cook-receipt.unit.test.d.ts.map +1 -0
  34. package/dist/__tests__/material-cook-schema.unit.test.d.ts +2 -0
  35. package/dist/__tests__/material-cook-schema.unit.test.d.ts.map +1 -0
  36. package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts +2 -0
  37. package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts.map +1 -0
  38. package/dist/__tests__/mesh-bin-contract.unit.test.d.ts +2 -0
  39. package/dist/__tests__/mesh-bin-contract.unit.test.d.ts.map +1 -0
  40. package/dist/__tests__/meta-schema-optional.test.d.ts +2 -0
  41. package/dist/__tests__/meta-schema-optional.test.d.ts.map +1 -0
  42. package/dist/__tests__/meta-source-overrides.unit.test.d.ts +2 -0
  43. package/dist/__tests__/meta-source-overrides.unit.test.d.ts.map +1 -0
  44. package/dist/__tests__/native-cooker-registry.test.d.ts +2 -0
  45. package/dist/__tests__/native-cooker-registry.test.d.ts.map +1 -0
  46. package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts +2 -0
  47. package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts.map +1 -0
  48. package/dist/__tests__/offline-evidence.integration.test.d.ts +2 -0
  49. package/dist/__tests__/offline-evidence.integration.test.d.ts.map +1 -0
  50. package/dist/__tests__/owner-chain.integration.test.d.ts +2 -0
  51. package/dist/__tests__/owner-chain.integration.test.d.ts.map +1 -0
  52. package/dist/__tests__/pack-v2-fixture-migration.test.d.ts +2 -0
  53. package/dist/__tests__/pack-v2-fixture-migration.test.d.ts.map +1 -0
  54. package/dist/__tests__/pack-v2-schema.test.d.ts +2 -0
  55. package/dist/__tests__/pack-v2-schema.test.d.ts.map +1 -0
  56. package/dist/__tests__/pack.unit.test.d.ts +2 -0
  57. package/dist/__tests__/pack.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/package-finalizer.contract.test.d.ts +2 -0
  59. package/dist/__tests__/package-finalizer.contract.test.d.ts.map +1 -0
  60. package/dist/__tests__/producer-contract-schema.unit.test.d.ts +2 -0
  61. package/dist/__tests__/producer-contract-schema.unit.test.d.ts.map +1 -0
  62. package/dist/__tests__/resolve-asset-source.test.d.ts +2 -0
  63. package/dist/__tests__/resolve-asset-source.test.d.ts.map +1 -0
  64. package/dist/__tests__/runtime-projection.unit.test.d.ts +2 -0
  65. package/dist/__tests__/runtime-projection.unit.test.d.ts.map +1 -0
  66. package/dist/__tests__/runtime.browser.test.d.ts +2 -0
  67. package/dist/__tests__/runtime.browser.test.d.ts.map +1 -0
  68. package/dist/__tests__/scanner-inventory.contract.test.d.ts +2 -0
  69. package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +1 -0
  70. package/dist/__tests__/scanner-inventory.test.d.ts +2 -0
  71. package/dist/__tests__/scanner-inventory.test.d.ts.map +1 -0
  72. package/dist/__tests__/scanner-mount-cycle.test.d.ts +2 -0
  73. package/dist/__tests__/scanner-mount-cycle.test.d.ts.map +1 -0
  74. package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts +2 -0
  75. package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts.map +1 -0
  76. package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts +2 -0
  77. package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts.map +1 -0
  78. package/dist/__tests__/scriptable-pack.test-d.d.ts +2 -0
  79. package/dist/__tests__/scriptable-pack.test-d.d.ts.map +1 -0
  80. package/dist/__tests__/scriptable-pack.unit.test.d.ts +2 -0
  81. package/dist/__tests__/scriptable-pack.unit.test.d.ts.map +1 -0
  82. package/dist/__tests__/topology-actions.unit.test.d.ts +2 -0
  83. package/dist/__tests__/topology-actions.unit.test.d.ts.map +1 -0
  84. package/dist/__tests__/topology.unit.test.d.ts +2 -0
  85. package/dist/__tests__/topology.unit.test.d.ts.map +1 -0
  86. package/dist/artifact-path.d.ts +9 -0
  87. package/dist/artifact-path.d.ts.map +1 -0
  88. package/dist/artifact-path.mjs +53 -0
  89. package/dist/artifact-path.mjs.map +1 -0
  90. package/dist/atlas/run-atlas.d.ts +8 -0
  91. package/dist/atlas/run-atlas.d.ts.map +1 -0
  92. package/dist/atlas/shelf-pack.d.ts +55 -0
  93. package/dist/atlas/shelf-pack.d.ts.map +1 -0
  94. package/dist/bridge.d.ts +2 -0
  95. package/dist/bridge.d.ts.map +1 -0
  96. package/dist/bridge.mjs +3 -0
  97. package/dist/bridge.mjs.map +1 -0
  98. package/dist/build.d.ts +19 -0
  99. package/dist/build.d.ts.map +1 -0
  100. package/dist/build.mjs +10203 -0
  101. package/dist/build.mjs.map +1 -0
  102. package/dist/builtin.d.ts +44 -0
  103. package/dist/builtin.d.ts.map +1 -0
  104. package/dist/builtin.mjs +141 -0
  105. package/dist/builtin.mjs.map +1 -0
  106. package/dist/catalog-builder.d.ts +43 -0
  107. package/dist/catalog-builder.d.ts.map +1 -0
  108. package/dist/catalog-delta.d.ts +11 -0
  109. package/dist/catalog-delta.d.ts.map +1 -0
  110. package/dist/catalog-projection.d.ts +91 -0
  111. package/dist/catalog-projection.d.ts.map +1 -0
  112. package/dist/cli-asset.d.ts +22 -0
  113. package/dist/cli-asset.d.ts.map +1 -0
  114. package/dist/cli-asset.mjs +9697 -0
  115. package/dist/cli-asset.mjs.map +1 -0
  116. package/dist/config.d.ts +6 -0
  117. package/dist/config.d.ts.map +1 -0
  118. package/dist/config.mjs +29 -0
  119. package/dist/config.mjs.map +1 -0
  120. package/dist/deriveAssetName.d.ts +15 -0
  121. package/dist/deriveAssetName.d.ts.map +1 -0
  122. package/dist/errors.d.ts +30 -0
  123. package/dist/errors.d.ts.map +1 -0
  124. package/dist/errors.mjs +19 -0
  125. package/dist/errors.mjs.map +1 -0
  126. package/dist/evidence/material-cook.d.ts +92 -0
  127. package/dist/evidence/material-cook.d.ts.map +1 -0
  128. package/dist/evidence/offline-evidence.d.ts +25 -0
  129. package/dist/evidence/offline-evidence.d.ts.map +1 -0
  130. package/dist/evidence/source-inventory.d.ts +29 -0
  131. package/dist/evidence/source-inventory.d.ts.map +1 -0
  132. package/dist/guid.d.ts +45 -0
  133. package/dist/guid.d.ts.map +1 -0
  134. package/dist/guid.mjs +94 -0
  135. package/dist/guid.mjs.map +1 -0
  136. package/dist/index.d.ts +15 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.mjs +8612 -0
  139. package/dist/index.mjs.map +1 -0
  140. package/dist/material/artifact-writer.d.ts +14 -0
  141. package/dist/material/artifact-writer.d.ts.map +1 -0
  142. package/dist/material-cook.d.ts +2 -0
  143. package/dist/material-cook.d.ts.map +1 -0
  144. package/dist/material-cook.mjs +248 -0
  145. package/dist/material-cook.mjs.map +1 -0
  146. package/dist/mesh-bin-contract.d.ts +36 -0
  147. package/dist/mesh-bin-contract.d.ts.map +1 -0
  148. package/dist/mesh-bin-contract.mjs +96 -0
  149. package/dist/mesh-bin-contract.mjs.map +1 -0
  150. package/dist/name.mjs +22 -0
  151. package/dist/name.mjs.map +1 -0
  152. package/dist/native-cooker-registry.d.ts +47 -0
  153. package/dist/native-cooker-registry.d.ts.map +1 -0
  154. package/dist/native-cooker.d.ts +3 -0
  155. package/dist/native-cooker.d.ts.map +1 -0
  156. package/dist/native-cooker.mjs +142 -0
  157. package/dist/native-cooker.mjs.map +1 -0
  158. package/dist/package-finalizer.d.ts +121 -0
  159. package/dist/package-finalizer.d.ts.map +1 -0
  160. package/dist/producer-contract.d.ts +19 -0
  161. package/dist/producer-contract.d.ts.map +1 -0
  162. package/dist/resolve-asset-source.d.ts +4 -0
  163. package/dist/resolve-asset-source.d.ts.map +1 -0
  164. package/dist/resolve-asset-source.mjs +109 -0
  165. package/dist/resolve-asset-source.mjs.map +1 -0
  166. package/dist/runtime-projection.d.ts +14 -0
  167. package/dist/runtime-projection.d.ts.map +1 -0
  168. package/dist/runtime-publication.d.ts +44 -0
  169. package/dist/runtime-publication.d.ts.map +1 -0
  170. package/dist/runtime.d.ts +8 -0
  171. package/dist/runtime.d.ts.map +1 -0
  172. package/dist/runtime.mjs +7261 -0
  173. package/dist/runtime.mjs.map +1 -0
  174. package/dist/scanner.d.ts +113 -0
  175. package/dist/scanner.d.ts.map +1 -0
  176. package/dist/scanner.mjs +8819 -0
  177. package/dist/scanner.mjs.map +1 -0
  178. package/dist/schema-compiled.d.ts +12 -0
  179. package/dist/schema-compiled.d.ts.map +1 -0
  180. package/dist/schema.mjs +7369 -0
  181. package/dist/schema.mjs.map +1 -0
  182. package/dist/scriptable-pack-node.d.ts +62 -0
  183. package/dist/scriptable-pack-node.d.ts.map +1 -0
  184. package/dist/scriptable-pack-node.mjs +1674 -0
  185. package/dist/scriptable-pack-node.mjs.map +1 -0
  186. package/dist/scriptable-pack-worker.d.ts +2 -0
  187. package/dist/scriptable-pack-worker.d.ts.map +1 -0
  188. package/dist/scriptable-pack-worker.mjs +224 -0
  189. package/dist/scriptable-pack-worker.mjs.map +1 -0
  190. package/dist/scriptable-pack.d.ts +558 -0
  191. package/dist/scriptable-pack.d.ts.map +1 -0
  192. package/dist/scriptable-pack.mjs +672 -0
  193. package/dist/scriptable-pack.mjs.map +1 -0
  194. package/dist/topology.d.ts +10 -0
  195. package/dist/topology.d.ts.map +1 -0
  196. package/package.json +154 -0
  197. package/schema/meta.schema.json +173 -0
  198. package/schema/pack.schema.json +232 -0
  199. package/src/__tests__/ai-recovery.unit.test.ts +114 -0
  200. package/src/__tests__/artifact-path.test.ts +41 -0
  201. package/src/__tests__/asset-evidence-error-hints.test.ts +46 -0
  202. package/src/__tests__/asset-evidence-lifecycle.test.ts +104 -0
  203. package/src/__tests__/asset-evidence-schema.test.ts +86 -0
  204. package/src/__tests__/atlas-cli-region-mismatch.test.ts +134 -0
  205. package/src/__tests__/atlas-error-code-owner.test-d.ts +23 -0
  206. package/src/__tests__/cli-asset-evidence.integration.test.ts +172 -0
  207. package/src/__tests__/cli.unit.test.ts +448 -0
  208. package/src/__tests__/evidence-source-inventory.unit.test.ts +37 -0
  209. package/src/__tests__/guid-collision.unit.test.ts +112 -0
  210. package/src/__tests__/guid-validator-surface.unit.test.ts +20 -0
  211. package/src/__tests__/load-asset-config.test.ts +121 -0
  212. package/src/__tests__/material-cook-dependencies.unit.test.ts +112 -0
  213. package/src/__tests__/material-cook-receipt.unit.test.ts +148 -0
  214. package/src/__tests__/material-cook-schema.unit.test.ts +152 -0
  215. package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +22 -0
  216. package/src/__tests__/mesh-bin-contract.unit.test.ts +32 -0
  217. package/src/__tests__/meta-schema-optional.test.ts +116 -0
  218. package/src/__tests__/meta-source-overrides.unit.test.ts +71 -0
  219. package/src/__tests__/native-cooker-registry.test.ts +64 -0
  220. package/src/__tests__/offline-evidence-artifact-verification-owner.test-d.ts +64 -0
  221. package/src/__tests__/offline-evidence.integration.test.ts +106 -0
  222. package/src/__tests__/owner-chain.integration.test.ts +78 -0
  223. package/src/__tests__/pack-v2-fixture-migration.test.ts +87 -0
  224. package/src/__tests__/pack-v2-schema.test.ts +142 -0
  225. package/src/__tests__/pack.unit.test.ts +2218 -0
  226. package/src/__tests__/package-finalizer.contract.test.ts +105 -0
  227. package/src/__tests__/producer-contract-schema.unit.test.ts +92 -0
  228. package/src/__tests__/resolve-asset-source.test.ts +121 -0
  229. package/src/__tests__/runtime-projection.unit.test.ts +87 -0
  230. package/src/__tests__/runtime.browser.test.ts +15 -0
  231. package/src/__tests__/scanner-inventory.contract.test.ts +167 -0
  232. package/src/__tests__/scanner-inventory.test.ts +76 -0
  233. package/src/__tests__/scanner-mount-cycle.test.ts +232 -0
  234. package/src/__tests__/scriptable-pack-cli.integration.test.ts +47 -0
  235. package/src/__tests__/scriptable-pack-ddc-key.unit.test.ts +63 -0
  236. package/src/__tests__/scriptable-pack.test-d.ts +131 -0
  237. package/src/__tests__/scriptable-pack.unit.test.ts +789 -0
  238. package/src/__tests__/topology-actions.unit.test.ts +94 -0
  239. package/src/__tests__/topology.unit.test.ts +85 -0
  240. package/src/artifact-path.ts +69 -0
  241. package/src/atlas/run-atlas.ts +358 -0
  242. package/src/atlas/shelf-pack.ts +172 -0
  243. package/src/atlas/upng-ambient.d.ts +13 -0
  244. package/src/bridge.ts +2 -0
  245. package/src/build.ts +139 -0
  246. package/src/builtin.ts +117 -0
  247. package/src/catalog-builder.ts +313 -0
  248. package/src/catalog-delta.ts +189 -0
  249. package/src/catalog-projection.ts +344 -0
  250. package/src/cli-asset.ts +586 -0
  251. package/src/config.ts +36 -0
  252. package/src/deriveAssetName.ts +42 -0
  253. package/src/errors.ts +47 -0
  254. package/src/evidence/material-cook.ts +411 -0
  255. package/src/evidence/offline-evidence.ts +90 -0
  256. package/src/evidence/source-inventory.ts +193 -0
  257. package/src/guid.ts +99 -0
  258. package/src/index.ts +108 -0
  259. package/src/material/artifact-writer.ts +26 -0
  260. package/src/material-cook.ts +15 -0
  261. package/src/mesh-bin-contract.ts +150 -0
  262. package/src/native-cooker-registry.ts +235 -0
  263. package/src/native-cooker.ts +2 -0
  264. package/src/package-finalizer.ts +394 -0
  265. package/src/producer-contract.ts +277 -0
  266. package/src/resolve-asset-source.ts +88 -0
  267. package/src/runtime-projection.ts +100 -0
  268. package/src/runtime-publication.ts +190 -0
  269. package/src/runtime.ts +23 -0
  270. package/src/scanner.ts +715 -0
  271. package/src/schema/material-cook.schema.json +119 -0
  272. package/src/schema-compiled.ts +238 -0
  273. package/src/scriptable-pack-node.ts +1394 -0
  274. package/src/scriptable-pack-worker.ts +308 -0
  275. package/src/scriptable-pack.ts +1006 -0
  276. package/src/topology.ts +157 -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,429 @@
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
+ ## Material contract index
18
+
19
+ Pack is the single material-cook and publication boundary. It publishes one
20
+ GUID-addressed receipt and artifact for the resolved contract; it does not
21
+ redefine `paramSchema` or mint runtime feature macros. Keep
22
+ `materialContractDigest`, `sourceClosureDigest`, `layoutIdentity`,
23
+ `programIdentity`, `cookIdentity`, and `materialPublicationIdentity` together
24
+ as layered identity. Inspect `current` versus `generation`, repair the owning
25
+ producer at the first divergence, cold-cook the same GUID, and verify receipt,
26
+ artifact, and provenance.
27
+
28
+ ## Mesh binary v4 boundary
29
+
30
+ Mesh artifacts use one canonical `geometry` projection and one strict wire
31
+ contract. The pack package owns the header facts and digest implementation in
32
+ [`src/mesh-bin-contract.ts`](src/mesh-bin-contract.ts); consumers must not
33
+ recreate that table.
34
+
35
+ | Fact | Owner | Recovery |
36
+ |:--|:--|:--|
37
+ | projection mask, schema version, stride, digest | `@forgeax/engine-geometry` + pack contract | Re-cook from source and Meta |
38
+ | vertex/index cardinality and payload bounds | build-time import producer | Repair source payload, then cold-cook |
39
+ | malformed or legacy mesh binary | strict runtime loader | Keep LKG; publish only a fully validated replacement |
40
+
41
+ > [!WARNING]
42
+ > Mesh binary v4 is the only accepted/emitted mesh wire version. v2/v3 are
43
+ > rejected closed; runtime never decodes or re-cooks a legacy payload.
44
+
45
+ ## ScriptablePack in 30 seconds
46
+
47
+ The public happy path is: declare GUIDs in a `*.pack.ts`, run the Vite Pack
48
+ producer, publish Pack v2 plus the Catalog, then call
49
+ `AssetRegistry.loadByGuid(guid)`. The durable consumer matrix is the exported
50
+ `SCRIPTABLE_PACK_ASSET_KINDS` list: mesh, material, scene, texture, equirect,
51
+ sampler, font, render-pipeline, tileset, video, skeleton, skin,
52
+ animation-clip, animation-graph, audio, and particle-effect.
53
+
54
+ Every successful row keeps its `sourceKey` identity, dependency `refs`, and
55
+ producer-owned `artifacts`. Audio keeps `mediaType` and bytes; particle effects
56
+ keep `programFingerprint` and the cooked program. Animation and tile consumers
57
+ turn a loaded payload into a World-owned shared reference at their own boundary.
58
+
59
+ For failure, switch on `code`, inspect `expected`, `hint`, and narrowed `detail`:
60
+ repair the definition or producer, rebuild/cold-cook, refresh the Catalog LKG,
61
+ or attach the missing Host capability. A missing audio/video/VFX capability is
62
+ an install/play/execute error, not a durable-load error. The machine contract
63
+ lives in [`pack.schema.json`](schema/pack.schema.json) and
64
+ [`meta.schema.json`](schema/meta.schema.json); this section is guidance, not a
65
+ second manifest.
66
+
67
+ 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.
68
+
69
+ The staged route is explicit: `author-validation` -> `external-declaration` ->
70
+ `import` -> `native-cook` -> `ddc-validation` -> `runtime-parse` ->
71
+ `editor-capability`. Each stage keeps its own evidence; a cache hit does not
72
+ replace author authority, and an Editor capability does not become a runtime
73
+ source.
74
+
75
+ | Need | Entry | Safe action |
76
+ |:--|:--|:--|
77
+ | Inspect one asset | `forgeax-engine-remote-asset lookup --guid ... --project ... --catalog ... --json` | Read structured evidence and diagnostics |
78
+ | Verify a result | `forgeax-engine-remote-asset verify --guid ... --project ... --catalog ... --json` | Repair the producer or package, then retry |
79
+ | Rebuild a cooked result | Pack/import runner and the declared producer | Cold cook after discarding invalid DDC |
80
+ | Preview old output | Catalog evidence with explicit last-known-good state | Preview only; never publish it as current |
81
+
82
+ Pack or external source plus Meta owns author facts. DDC and Catalog are derived projections; they are not author databases or write authorities.
83
+
84
+ ## Engine builtin mesh descriptors
85
+
86
+ The Engine-owned primitive mesh identities are published from one UUIDv5 table
87
+ (`@forgeax/engine-pack/builtin`). A standalone DevKit build materializes only
88
+ the missing rows as an ordinary Pack v2 tuple; Geometry then derives the mesh
89
+ payload from the `procedural-*` token at load time.
90
+
91
+ | Descriptor | GUID source | Geometry token |
92
+ |:--|:--|:--|
93
+ | Cube | `HANDLE_CUBE` | `procedural-cube` |
94
+ | Triangle | `HANDLE_TRIANGLE` | `procedural-triangle` |
95
+ | Quad | `HANDLE_QUAD` | `procedural-quad` |
96
+ | Sphere | `HANDLE_SPHERE` | `procedural-sphere` |
97
+ | Nine-slice quad | `HANDLE_NINESLICE_QUAD` | `procedural-nine-slice-quad` |
98
+ | Cylinder | `HANDLE_CYLINDER` | `procedural-cylinder` |
99
+
100
+ This keeps the runtime registry generic while ensuring a packaged game can
101
+ resolve legacy scene references without a second process-static asset owner.
102
+
103
+ > [!IMPORTANT]
104
+ > 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.
105
+
106
+ ## MaterialAsset cook contract
107
+
108
+ 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`.
109
+
110
+ 当 `parameters` 将字段声明为 `texture` 时,`values` 可保留纹理 GUID 字符串简写;省略
111
+ `parameters` 的默认材质也只对 `MATERIAL_TEXTURE_SLOTS` 中的纹理槽启用该简写。只有
112
+ sampler、强度或非默认坐标等附加元数据才使用结构化纹理对象。坐标字段的省略由运行时
113
+ 统一解析为 identity,但 cook/load 不得把 identity 坐标自动展开并写回创作 payload。
114
+
115
+ > [!IMPORTANT]
116
+ > The producer publishes facts; the consumer does not guess. `packageId`,
117
+ > `provenance`, `revision`, `sourceKey`, relations, and diagnostics survive
118
+ > package moves and DDC relocation. Paths and array positions are locators,
119
+ > not identities.
120
+
121
+ 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).
122
+
123
+ > 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.
124
+
125
+ ## AssetEvidence: the offline proof chain
126
+
127
+ Pack owns the offline half of the GUID evidence chain: `source inventory -> catalog packageUrl/cookReceiptUrl -> producer CookReceipt -> Pack v2 package and artifact verification -> AssetEvidence`.
128
+
129
+ 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.
130
+
131
+ ## VFX Pack v2 migration
132
+
133
+ VFX source v2 is cooked in one atomic producer step. The executable contract is
134
+ `scripts/asset-cook-contract.mjs`; a package-local scripts path is not valid.
135
+ The cook publishes the Pack payload and
136
+ `particle-effect/program.json` with the same source fingerprint. Runtime loads
137
+ the GUID-indexed artifact and never compiles author WGSL.
138
+
139
+ When adding a Batch B renderer, update the source declaration, explicit material
140
+ or mesh refs, native-cook catalog, and receipt together. Re-run `lookup` and
141
+ `verify`; stale output is repaired by the owning importer or native cooker, not
142
+ by a demo-side mesh substitute.
143
+
144
+ `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.
145
+
146
+ 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.
147
+
148
+ Browser runtime code uses the focused Pack subpaths instead of the Node-oriented
149
+ root barrel. The root entry remains the build-time scanner/evidence surface.
150
+
151
+ | Runtime need | Browser-safe entry |
152
+ |:--|:--|
153
+ | Pack v2 validation and parsing | `@forgeax/engine-pack/runtime` |
154
+ | Artifact locator validation | `@forgeax/engine-pack/artifact-path` |
155
+ | Cooked material records | `@forgeax/engine-pack/material-cook` |
156
+ | Mesh wire facts | `@forgeax/engine-pack/mesh-bin-contract` |
157
+
158
+ ## Quick start
159
+
160
+ ### ScriptablePack source
161
+
162
+ 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`, optional display `name`, and the scene component schema needed to externalize scene refs. `build(reader)` returns ordinary typed Assets keyed by the same `sourceKey` set; it cannot publish, mutate Catalog, or mint identity.
163
+
164
+ ```ts
165
+ import type { ScriptablePackDefinition } from '@forgeax/engine-pack/source';
166
+ import { Camera } from '@forgeax/engine-render';
167
+ import { Transform } from '@forgeax/engine-scene';
168
+
169
+ export default {
170
+ schemaVersion: '1.0.0',
171
+ packageId,
172
+ assets: {
173
+ mesh: { guid: meshGuid, kind: 'mesh', name: 'Generated Mesh' },
174
+ scene: { guid: sceneGuid, kind: 'scene', name: 'Generated Scene' },
175
+ },
176
+ sceneComponents: [Transform, Camera],
177
+ externalAssets: { material: materialGuid },
178
+ build: async (assets) => ({ ok: true, value: { mesh, scene } }),
179
+ } satisfies ScriptablePackDefinition;
180
+ ```
181
+
182
+ `sceneComponents` is optional for packs that never produce a `scene`. When a
183
+ scene is produced, declare every component used by its entities in the same
184
+ definition; the isolated Pack worker projects the tokens to a neutral,
185
+ serializable schema. A scene component missing from that declaration is a
186
+ fail-closed producer error, not a lookup into a global World schema.
187
+
188
+ `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.
189
+
190
+ 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.
191
+
192
+ > [!IMPORTANT]
193
+ > 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.
194
+
195
+ `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.
196
+
197
+ ```typescript
198
+ import { AssetGuid } from "@forgeax/engine-pack/guid";
199
+ import { scan, scanInventory } from "@forgeax/engine-pack/scanner";
200
+
201
+ // Runtime: resolve a known GUID at build time
202
+ const result = AssetGuid.parse("cbe42beb-8975-5096-b3a1-3dda4cb4c077");
203
+ if (!result.ok) throw result.error; // PackError with .code 'pack-guid-malformed'
204
+ const guid = result.value;
205
+
206
+ // Build / CI: validate an asset directory
207
+ const scanResult = await scan(["apps/hello/cube/assets"]);
208
+ if (!scanResult.ok) throw scanResult.error; // PackError with .code/.hint/.detail
209
+ console.log(scanResult.value); // PackEntry[]
210
+
211
+ // Build hosts can retain one validated inventory and project paths from it.
212
+ const inventory = await scanInventory(["apps/hello/cube/assets"]);
213
+ if (!inventory.ok) throw inventory.error;
214
+ console.log(inventory.value.paths, inventory.value.scriptablePackMeta);
215
+ ```
216
+
217
+ ## Schema shapes
218
+
219
+ Two sidecar JSON files live next to each source file in an asset directory:
220
+
221
+ ### `.meta.json` -- external-asset-package
222
+
223
+ ```json
224
+ {
225
+ "schemaVersion": "1.0.0",
226
+ "kind": "external-asset-package",
227
+ "importer": "gltf",
228
+ "source": "<source-filename>",
229
+ "importSettings": {},
230
+ "subAssets": [
231
+ { "guid": "<UUIDv7-or-UUIDv5>", "sourceIndex": 0, "kind": "mesh", "compression": "zstd" }
232
+ ]
233
+ }
234
+
235
+ > [!NOTE]
236
+ > `compression?: 'none' | 'zstd'` on `PackIndexEntry` (and `subAssets[].compression`)
237
+ > indicates whether the asset's `.bin` is zstd-compressed. See
238
+ > `@forgeax/engine-codec` README for the full codec API and error codes.
239
+ > Runtime `fetchBinary` transparently decompresses when this field is `'zstd'`.
240
+ >
241
+ > **Declaring compression intent (AC-01):** set `importSettings.compression`
242
+ > (`'none' | 'zstd'`) to override the build-time default strategy for this asset
243
+ > (default: mesh -> `zstd`, texture -> `none`; `.pack.json` never compressed).
244
+ > The importer honors the override and writes the resulting `compression` onto
245
+ > the output catalog row. Omit it to accept the kind-keyed default.
246
+ ```
247
+
248
+ ### `.pack.json` -- internal-text-package
249
+
250
+ ```json
251
+ {
252
+ "schemaVersion": "1.0.0",
253
+ "kind": "internal-text-package",
254
+ "assets": [
255
+ {
256
+ "guid": "<UUIDv7-or-UUIDv5>",
257
+ "kind": "mesh",
258
+ "payload": {},
259
+ "refs": []
260
+ }
261
+ ]
262
+ }
263
+ ```
264
+
265
+ ### Producer provenance and topology
266
+
267
+ Both package schemas accept producer-owned `packageId`, `provenance`,
268
+ `revision`, and structured `diagnostics`. Asset/output rows may declare a
269
+ stable `sourceKey`; `sourceIndex` is positional evidence only. The runtime
270
+ function `diffTopology(previous, next)` preserves GUIDs by `sourceKey`, reports additions,
271
+ removals, and kind changes, and marks multi-output source-index-only matching
272
+ as ambiguous.
273
+
274
+ | Fact | Published by | Consumer rule |
275
+ |:--|:--|:--|
276
+ | `packageId` | Producer declaration | Keep stable across path or URL relocation |
277
+ | `provenance` | Producer declaration | Copy without replacing it with importer guesses |
278
+ | `revision` | Producer/DDC | Use to detect stale updates; do not silently overwrite a verified snapshot |
279
+ | `sourceKey` | Imported-output producer | Match topology only when the producer supplies a stable semantic key |
280
+ | `sourceIndex` | Imported-output producer | Display or inspect position; never use it as identity |
281
+ | `relations` / `diagnostics` | Producer facts | Preserve the complete structured values |
282
+
283
+ > [!WARNING]
284
+ > A missing `sourceKey` in a multi-output declaration is evidence insufficiency,
285
+ > not permission to hash a path or promote `sourceIndex`. Keep the result
286
+ > ambiguous and expose the repair hint.
287
+
288
+ The DDC path is also lossless: the import runner copies package-level facts to
289
+ the `.pack.json` envelope and copies each declared output's `sourceKey`,
290
+ `sourceIndex`, and relations onto the matching GUID row. The catalog builder
291
+ then projects those rows into `PackIndexEntry`; it does not create a second
292
+ authoritative fact store.
293
+
294
+ ### MaterialAsset shape -- pass-based material in `.pack.json`
295
+
296
+ When `kind: 'material'`, the `payload` object carries `passes[]` + `values` (feat-20260527-material-registration-unification M3).
297
+
298
+ ```json
299
+ {
300
+ "guid": "<UUIDv7>",
301
+ "kind": "material",
302
+ "payload": {
303
+ "kind": "material",
304
+ "passes": [
305
+ {
306
+ "name": "Forward",
307
+ "program": { "module": "forgeax::default-standard-pbr" }
308
+ }
309
+ ],
310
+ "values": {
311
+ "baseColor": [1.0, 0.8, 0.2],
312
+ "metallic": 0.3
313
+ }
314
+ },
315
+ "refs": []
316
+ }
317
+ ```
318
+
319
+ **MaterialAsset fields in pack.json**:
320
+
321
+ | Field | Type | Description |
322
+ |:--|:--|:--|
323
+ | `passes` | `MaterialPass[]` | Root pass descriptors; each pass names a `program.module`. |
324
+ | `parameters` | `MaterialParameter[]` | Root parameter contract used by cook and reflection. |
325
+ | `values` | `Record<string, unknown>` | Child-owned values, including per-slot texture coordinates. |
326
+ | `parent` | `AssetGuid` | Optional serialized parent edge. |
327
+
328
+ **Validation** is performed by the material schema and build-time cook. The cook resolves the parent chain, validates values and pass programs, and emits a `material-cook/3` record, artifact, references, and receipt. The receipt keeps material, source, layout, program, pipeline, publication, and cook identities together with compiler/WASM provenance and generation counters. Runtime reports a structured missing-cook error instead of compiling a material; stale generations are recooked by the producer.
329
+
330
+ ## `AssetGuid` API
331
+
332
+ | Function | Signature | Description |
333
+ |:--|:--|:--|
334
+ | `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. |
335
+ | `AssetGuid.format` | `(guid: AssetGuid) => string` | Format as lowercase dash-separated UUID string |
336
+ | `AssetGuid.equals` | `(a: AssetGuid, b: AssetGuid) => boolean` | Constant-time equality |
337
+ | `AssetGuid.random` | `() => AssetGuid` | Generate a random UUIDv7 GUID |
338
+ | `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) |
339
+
340
+ ## `PackErrorCode` -- 13-member closed union
341
+
342
+ Exhaustive `switch (err.code)` without `default` -- TS guards completeness.
343
+
344
+ | Code | `err.detail` shape |
345
+ |:--|:--|
346
+ | `pack-malformed-meta` | `{ path: string; ajvErrors: string[] }` |
347
+ | `pack-malformed-pack` | `{ path: string; ajvErrors: string[] }` |
348
+ | `pack-guid-malformed` | `{ raw: string; reason: string }` |
349
+ | `pack-orphan-meta` | `{ metaPath: string; expectedFile: string }` |
350
+ | `pack-meta-missing` | `{ sourcePath: string; expectedMetaPath: string }` |
351
+ | `pack-guid-collision` | `{ guid: string; paths: [string, string] }` |
352
+ | `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) |
353
+ | `pack-subasset-index-out-of-range` | `{ metaPath: string; sourceIndex: number; maxIndex: number }` |
354
+ | `payload-schema-mismatch` | `{ guid: string; errors: { instancePath: string; message: string }[] }` -- material payload failed `buildMaterialAssetValidator` check (scanner step-7) |
355
+ | `pack-mount-localid-overlap` | `{ overlapping: number[]; sources: string[] }` -- mount memberFirst windows collide |
356
+ | `pack-mount-count-mismatch` | `{ mountLocalId; declared; actual }` -- mount.memberCount disagrees with referenced child SceneAsset.entities.length |
357
+ | `pack-mount-override-localid-out-of-range` | `{ overrideLocalId; mountLocalId; memberCount }` -- override.localId outside mount window |
358
+ | `pack-mount-override-unknown-field` | `{ comp; field; mountLocalId }` -- override.comp / override.field unknown to schema vocab |
359
+
360
+ Access `err.detail.<field>` directly after narrowing via `switch (err.code)` -- full IDE autocomplete.
361
+
362
+ ## CLI plugin -- `forgeax-engine-remote-asset`
363
+
364
+ 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-`.
365
+
366
+ | Subcommand | Description | Exit code |
367
+ |:--|:--|:--|
368
+ | `forgeax-engine-remote-asset scan [--roots <dir>...]` | Print JSON array of all discovered `PackEntry` objects to stdout | 0 always |
369
+ | `forgeax-engine-remote-asset lookup <guid>` | Print matching `PackEntry` as JSON to stdout (cwd as scan root) | 0 found / 1 not found |
370
+ | `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 |
371
+
372
+ ```bash
373
+ # Direct invocation (after pnpm -F @forgeax/engine-pack build)
374
+ forgeax-engine-remote-asset scan --roots apps/hello/room/assets
375
+ forgeax-engine-remote-asset lookup 01935f3b-aaaa-7000-8000-000000000001
376
+ forgeax-engine-remote-asset verify --strict
377
+ ```
378
+
379
+ ## Scanner 7-step validation chain
380
+
381
+ The `verify` subcommand runs a fail-fast 7-step chain:
382
+
383
+ | Step | Check | Error code on failure |
384
+ |:--|:--|:--|
385
+ | 1 | Schema validation (`.meta.json` / `.pack.json` ajv) | `pack-malformed-meta` / `pack-malformed-pack` |
386
+ | 2 | GUID format check (UUIDv5/v7 dash format) | `pack-guid-malformed` |
387
+ | 3 | GUID collision detection (cross-file duplicate) | `pack-guid-collision` |
388
+ | 4 | Orphan `.meta.json` check (`.meta.json` without source file) | `pack-orphan-meta` |
389
+ | 5 | Missing `.meta.json` check (source file without sidecar) | `pack-meta-missing` |
390
+ | 6 | Subasset index bounds check (`.meta.json` subAssets[].sourceIndex) | `pack-subasset-index-out-of-range` |
391
+ | 7 | Material payload schema check (`buildMaterialAssetValidator(MATERIAL_PARAM_TYPES_V1)` for `kind: 'material'`) | `payload-schema-mismatch` |
392
+
393
+ ## Mesh-binary artifact contract
394
+
395
+ `MESH_BIN_VERSION` and `MESH_BIN_HEADER_V4_BYTES` are the Pack-owned facts for
396
+ the v4 `<guid>.bin` mesh artifact. The header carries the geometry projection
397
+ version, attribute mask, stride, digest, cardinality, and payload byte lengths;
398
+ the import encoder and assets-runtime decoder consume those facts from the
399
+ package root. Independent test fixtures may keep literal header values only as
400
+ wire-format oracles, never as a second layout table.
401
+
402
+ > [!WARNING]
403
+ > v4 is the only accepted and emitted mesh-binary version. A v2/v3 artifact is
404
+ > a closed load error, not a compatibility input. Preserve the last-known-good
405
+ > catalog row, repair the source plus its `.meta.json` sidecar, then re-run the
406
+ > owning build-time importer/native cooker and `lookup/verify --guid --project
407
+ > --catalog --json` before publishing the replacement.
408
+
409
+ ## Owner product and inventory contract
410
+
411
+ `scanInventory(...)` is the Pack-owned source inventory boundary. It preserves
412
+ GUID identity, source revision, source key, and source index before importer
413
+ work begins.
414
+
415
+ `finalizePackageProduct(...)` accepts the terminal producer product, validates
416
+ one receipt per GUID, validates asset-local artifact paths and bytes, and emits
417
+ the deterministic package URL and digest. Producers provide policy through the
418
+ finalizer sink; Pack owns package serialization and publication facts.
419
+
420
+ ## Entry subpaths
421
+
422
+ | Subpath | Exports |
423
+ |:--|:--|
424
+ | `.` | Re-exports from all subpaths |
425
+ | `./schema` | Compiled ajv validators for `.meta.json` and `.pack.json` |
426
+ | `./guid` | `AssetGuid` brand type + `parse` (returns `Result`) / `format` / `equals` / `random` + async `deriveBuiltin(name)` |
427
+ | `./errors` | `PackError` class + `PackErrorCode` closed union + `PackErrorDetail` discriminated union |
428
+ | `./bridge` | `AssetRegistry` GUID bridge helpers |
429
+ | `./scanner` | File tree scanner with fail-fast 7-step validation chain |