@forgeax/engine-pack 0.1.3 → 0.1.6

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 (95) hide show
  1. package/README.md +52 -4
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/__tests__/owner-chain.integration.test.d.ts +2 -0
  4. package/dist/__tests__/owner-chain.integration.test.d.ts.map +1 -0
  5. package/dist/__tests__/package-finalizer.contract.test.d.ts +2 -0
  6. package/dist/__tests__/package-finalizer.contract.test.d.ts.map +1 -0
  7. package/dist/__tests__/runtime.browser.test.d.ts +2 -0
  8. package/dist/__tests__/runtime.browser.test.d.ts.map +1 -0
  9. package/dist/__tests__/scanner-inventory.contract.test.d.ts +2 -0
  10. package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +1 -0
  11. package/dist/artifact-path.mjs +53 -0
  12. package/dist/artifact-path.mjs.map +1 -0
  13. package/dist/atlas/shelf-pack.d.ts.map +1 -1
  14. package/dist/build.d.ts +19 -0
  15. package/dist/build.d.ts.map +1 -0
  16. package/dist/build.mjs +10168 -0
  17. package/dist/build.mjs.map +1 -0
  18. package/dist/builtin.d.ts +20 -0
  19. package/dist/builtin.d.ts.map +1 -1
  20. package/dist/builtin.mjs +141 -0
  21. package/dist/builtin.mjs.map +1 -0
  22. package/dist/catalog-builder.d.ts +43 -0
  23. package/dist/catalog-builder.d.ts.map +1 -0
  24. package/dist/catalog-delta.d.ts +11 -0
  25. package/dist/catalog-delta.d.ts.map +1 -0
  26. package/dist/catalog-projection.d.ts +91 -0
  27. package/dist/catalog-projection.d.ts.map +1 -0
  28. package/dist/cli-asset.mjs +231 -484
  29. package/dist/cli-asset.mjs.map +1 -1
  30. package/dist/index.mjs +83 -1
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/material-cook.d.ts +2 -0
  33. package/dist/material-cook.d.ts.map +1 -0
  34. package/dist/material-cook.mjs +193 -0
  35. package/dist/material-cook.mjs.map +1 -0
  36. package/dist/mesh-bin-contract.mjs +96 -0
  37. package/dist/mesh-bin-contract.mjs.map +1 -0
  38. package/dist/native-cooker-registry.d.ts +19 -0
  39. package/dist/native-cooker-registry.d.ts.map +1 -1
  40. package/dist/native-cooker.mjs +37 -0
  41. package/dist/native-cooker.mjs.map +1 -1
  42. package/dist/package-finalizer.d.ts +121 -0
  43. package/dist/package-finalizer.d.ts.map +1 -0
  44. package/dist/resolve-asset-source.d.ts.map +1 -1
  45. package/dist/resolve-asset-source.mjs +16 -6
  46. package/dist/resolve-asset-source.mjs.map +1 -1
  47. package/dist/runtime-publication.d.ts +44 -0
  48. package/dist/runtime-publication.d.ts.map +1 -0
  49. package/dist/runtime.d.ts +8 -0
  50. package/dist/runtime.d.ts.map +1 -0
  51. package/dist/runtime.mjs +7261 -0
  52. package/dist/runtime.mjs.map +1 -0
  53. package/dist/scanner.d.ts +87 -54
  54. package/dist/scanner.d.ts.map +1 -1
  55. package/dist/scanner.mjs +258 -454
  56. package/dist/scanner.mjs.map +1 -1
  57. package/dist/scriptable-pack-node.d.ts +3 -8
  58. package/dist/scriptable-pack-node.d.ts.map +1 -1
  59. package/dist/scriptable-pack-node.mjs +93 -9
  60. package/dist/scriptable-pack-node.mjs.map +1 -1
  61. package/dist/scriptable-pack-worker.mjs +1 -0
  62. package/dist/scriptable-pack-worker.mjs.map +1 -1
  63. package/dist/scriptable-pack.d.ts +33 -0
  64. package/dist/scriptable-pack.d.ts.map +1 -1
  65. package/dist/scriptable-pack.mjs +91 -2
  66. package/dist/scriptable-pack.mjs.map +1 -1
  67. package/dist/topology.d.ts +1 -1
  68. package/dist/topology.d.ts.map +1 -1
  69. package/package.json +27 -2
  70. package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +2 -1
  71. package/src/__tests__/owner-chain.integration.test.ts +78 -0
  72. package/src/__tests__/package-finalizer.contract.test.ts +105 -0
  73. package/src/__tests__/runtime.browser.test.ts +15 -0
  74. package/src/__tests__/scanner-inventory.contract.test.ts +167 -0
  75. package/src/__tests__/scanner-inventory.test.ts +16 -12
  76. package/src/__tests__/scriptable-pack.unit.test.ts +42 -0
  77. package/src/atlas/shelf-pack.ts +20 -24
  78. package/src/build.ts +139 -0
  79. package/src/builtin.ts +38 -0
  80. package/src/catalog-builder.ts +313 -0
  81. package/src/catalog-delta.ts +189 -0
  82. package/src/catalog-projection.ts +344 -0
  83. package/src/cli-asset.ts +1 -5
  84. package/src/index.ts +2 -2
  85. package/src/material-cook.ts +13 -0
  86. package/src/native-cooker-registry.ts +72 -0
  87. package/src/package-finalizer.ts +394 -0
  88. package/src/resolve-asset-source.ts +2 -7
  89. package/src/runtime-publication.ts +190 -0
  90. package/src/runtime.ts +23 -0
  91. package/src/scanner.ts +289 -290
  92. package/src/scriptable-pack-node.ts +27 -23
  93. package/src/scriptable-pack-worker.ts +2 -0
  94. package/src/scriptable-pack.ts +123 -1
  95. package/src/topology.ts +2 -1
package/dist/builtin.d.ts CHANGED
@@ -21,4 +21,24 @@ export declare const BUILTIN_HANDLE_TRIANGLE: string;
21
21
  * Derived from: deriveBuiltin('HANDLE_QUAD') under FORGEAX_NAMESPACE.
22
22
  */
23
23
  export declare const BUILTIN_HANDLE_QUAD: string;
24
+ /** Pre-computed UUIDv5 for the Engine-owned sphere mesh descriptor. */
25
+ export declare const BUILTIN_HANDLE_SPHERE: string;
26
+ /** Pre-computed UUIDv5 for the Engine-owned nine-slice quad descriptor. */
27
+ export declare const BUILTIN_HANDLE_NINESLICE_QUAD: string;
28
+ /** Pre-computed UUIDv5 for the Engine-owned cylinder mesh descriptor. */
29
+ export declare const BUILTIN_HANDLE_CYLINDER: string;
30
+ export type BuiltinMeshGeometry = 'procedural-cube' | 'procedural-triangle' | 'procedural-quad' | 'procedural-sphere' | 'procedural-nine-slice-quad' | 'procedural-cylinder';
31
+ /**
32
+ * The complete Engine-owned procedural mesh catalog.
33
+ *
34
+ * These are Pack descriptors, not runtime payloads: the Geometry decoder
35
+ * expands each `geometry` token into its validated MeshAsset. DevKit uses this
36
+ * list to materialize only the descriptors a standalone project does not
37
+ * already author, keeping the shipped game self-contained without duplicate
38
+ * GUID declarations.
39
+ */
40
+ export declare const BUILTIN_MESH_ASSETS: ReadonlyArray<{
41
+ readonly guid: string;
42
+ readonly geometry: BuiltinMeshGeometry;
43
+ }>;
24
44
  //# sourceMappingURL=builtin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAU3C,eAAO,MAAM,iBAAiB,EAAE,SAA2B,CAAC;AAE5D;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAmCpE;AAUD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAkC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAsC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAkC,CAAC"}
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAU3C,eAAO,MAAM,iBAAiB,EAAE,SAA2B,CAAC;AAE5D;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAmCpE;AAUD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAkC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAsC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAkC,CAAC;AAEnE,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,QAAoC,CAAC;AAEvE,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,QAA4C,CAAC;AAEvF,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,QAAsC,CAAC;AAE3E,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,qBAAqB,GACrB,iBAAiB,GACjB,mBAAmB,GACnB,4BAA4B,GAC5B,qBAAqB,CAAC;AAE1B;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACxC,CAOC,CAAC"}
@@ -0,0 +1,141 @@
1
+ import { uuidv7obj } from 'uuidv7';
2
+
3
+ // src/guid.ts
4
+
5
+ // src/errors.ts
6
+ var PackError = class extends Error {
7
+ code;
8
+ expected;
9
+ hint;
10
+ detail;
11
+ constructor(args) {
12
+ super(`[PackError ${args.code}] expected: ${args.expected}; hint: ${args.hint}`);
13
+ this.name = "PackError";
14
+ this.code = args.code;
15
+ this.expected = args.expected;
16
+ this.hint = args.hint;
17
+ this.detail = args.detail;
18
+ }
19
+ };
20
+
21
+ // src/guid.ts
22
+ function brand(bytes) {
23
+ return bytes;
24
+ }
25
+ var HEX_BYTE = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
26
+ function bytesToDashForm(bytes) {
27
+ const h = HEX_BYTE;
28
+ return `${h[bytes[0]]}${h[bytes[1]]}${h[bytes[2]]}${h[bytes[3]]}-${h[bytes[4]]}${h[bytes[5]]}-${h[bytes[6]]}${h[bytes[7]]}-${h[bytes[8]]}${h[bytes[9]]}-${h[bytes[10]]}${h[bytes[11]]}${h[bytes[12]]}${h[bytes[13]]}${h[bytes[14]]}${h[bytes[15]]}`;
29
+ }
30
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
31
+ function isValidAssetGuidString(value) {
32
+ return typeof value === "string" && UUID_RE.test(value);
33
+ }
34
+ function dashFormToBytes(dashForm) {
35
+ const hex = dashForm.replace(/-/g, "");
36
+ const bytes = new Uint8Array(16);
37
+ for (let i = 0; i < 16; i++) {
38
+ bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
39
+ }
40
+ return bytes;
41
+ }
42
+ var AssetGuid = {
43
+ /**
44
+ * Parse a 36-char RFC 4122 dash-form UUID string into an AssetGuid.
45
+ * Returns Ok(AssetGuid) on success or Err(PackError) with code 'pack-guid-malformed' on failure.
46
+ * Never throws for expected failures (requirements §4.2 / §14 / charter proposition 4).
47
+ */
48
+ parse(dashForm) {
49
+ if (!isValidAssetGuidString(dashForm)) {
50
+ return {
51
+ ok: false,
52
+ error: new PackError({
53
+ code: "pack-guid-malformed",
54
+ expected: "36-char RFC 4122 dash-form UUID",
55
+ hint: "use AssetGuid.random() or a UUIDv7 generator; all GUID fields must be 36-char RFC 4122 dash-form",
56
+ detail: {
57
+ raw: dashForm,
58
+ reason: "expected 36-char RFC 4122 dash-form UUID"
59
+ }
60
+ })
61
+ };
62
+ }
63
+ return { ok: true, value: brand(dashFormToBytes(dashForm)) };
64
+ },
65
+ /**
66
+ * Format an AssetGuid as a 36-char RFC 4122 lowercase dash-form string.
67
+ */
68
+ format(guid) {
69
+ return bytesToDashForm(guid);
70
+ },
71
+ /**
72
+ * Test byte-by-byte equality between two AssetGuids.
73
+ */
74
+ equals(a, b) {
75
+ for (let i = 0; i < 16; i++) {
76
+ if (a[i] !== b[i]) return false;
77
+ }
78
+ return true;
79
+ },
80
+ /**
81
+ * Mint a new time-ordered UUIDv7 as an AssetGuid.
82
+ * Works in both Node.js and browser environments.
83
+ */
84
+ random() {
85
+ const uuid = uuidv7obj();
86
+ const bytes = new Uint8Array(16);
87
+ bytes.set(uuid.bytes);
88
+ return brand(bytes);
89
+ }
90
+ };
91
+
92
+ // src/builtin.ts
93
+ var _nsResult = AssetGuid.parse("9a09805a-7623-482e-b322-9fc3591f2a38");
94
+ if (!_nsResult.ok) throw new Error("builtin: FORGEAX_NAMESPACE is not a valid UUID");
95
+ var FORGEAX_NAMESPACE = _nsResult.value;
96
+ async function deriveBuiltin(name) {
97
+ const nsBytes = FORGEAX_NAMESPACE;
98
+ const nameBytes = new TextEncoder().encode(name);
99
+ const concat = new Uint8Array(16 + nameBytes.length);
100
+ concat.set(nsBytes, 0);
101
+ concat.set(nameBytes, 16);
102
+ let hashBytes;
103
+ if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle !== void 0) {
104
+ const buffer = await globalThis.crypto.subtle.digest("SHA-1", concat);
105
+ hashBytes = new Uint8Array(buffer);
106
+ } else {
107
+ const { createHash } = await import('crypto');
108
+ const hash = createHash("sha1");
109
+ hash.update(concat);
110
+ hashBytes = hash.digest();
111
+ }
112
+ const uuidBytes = new Uint8Array(16);
113
+ uuidBytes.set(hashBytes.subarray(0, 16));
114
+ uuidBytes[6] = uuidBytes[6] & 15 | 80;
115
+ uuidBytes[8] = uuidBytes[8] & 63 | 128;
116
+ return uuidBytes;
117
+ }
118
+ function formatSync(bytes) {
119
+ return AssetGuid.format(bytes);
120
+ }
121
+ async function deriveSync(name) {
122
+ return formatSync(await deriveBuiltin(name));
123
+ }
124
+ var BUILTIN_HANDLE_CUBE = await deriveSync("HANDLE_CUBE");
125
+ var BUILTIN_HANDLE_TRIANGLE = await deriveSync("HANDLE_TRIANGLE");
126
+ var BUILTIN_HANDLE_QUAD = await deriveSync("HANDLE_QUAD");
127
+ var BUILTIN_HANDLE_SPHERE = await deriveSync("HANDLE_SPHERE");
128
+ var BUILTIN_HANDLE_NINESLICE_QUAD = await deriveSync("HANDLE_NINESLICE_QUAD");
129
+ var BUILTIN_HANDLE_CYLINDER = await deriveSync("HANDLE_CYLINDER");
130
+ var BUILTIN_MESH_ASSETS = Object.freeze([
131
+ { guid: BUILTIN_HANDLE_CUBE, geometry: "procedural-cube" },
132
+ { guid: BUILTIN_HANDLE_TRIANGLE, geometry: "procedural-triangle" },
133
+ { guid: BUILTIN_HANDLE_QUAD, geometry: "procedural-quad" },
134
+ { guid: BUILTIN_HANDLE_SPHERE, geometry: "procedural-sphere" },
135
+ { guid: BUILTIN_HANDLE_NINESLICE_QUAD, geometry: "procedural-nine-slice-quad" },
136
+ { guid: BUILTIN_HANDLE_CYLINDER, geometry: "procedural-cylinder" }
137
+ ]);
138
+
139
+ export { BUILTIN_HANDLE_CUBE, BUILTIN_HANDLE_CYLINDER, BUILTIN_HANDLE_NINESLICE_QUAD, BUILTIN_HANDLE_QUAD, BUILTIN_HANDLE_SPHERE, BUILTIN_HANDLE_TRIANGLE, BUILTIN_MESH_ASSETS, FORGEAX_NAMESPACE, deriveBuiltin };
140
+ //# sourceMappingURL=builtin.mjs.map
141
+ //# sourceMappingURL=builtin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/guid.ts","../src/builtin.ts"],"names":[],"mappings":";;;;;AA2BO,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EAC1B,IAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EAET,YAAY,IAAA,EAKT;AACD,IAAA,KAAA,CAAM,CAAA,WAAA,EAAc,KAAK,IAAI,CAAA,YAAA,EAAe,KAAK,QAAQ,CAAA,QAAA,EAAW,IAAA,CAAK,IAAI,CAAA,CAAE,CAAA;AAC/E,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,WAAW,IAAA,CAAK,QAAA;AACrB,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,SAAS,IAAA,CAAK,MAAA;AAAA,EACrB;AACF,CAAA;;;AC/BA,SAAS,MAAM,KAAA,EAA8B;AAC3C,EAAA,OAAO,KAAA;AACT;AAEA,IAAM,WAAW,KAAA,CAAM,IAAA,CAAK,EAAE,MAAA,EAAQ,KAAI,EAAG,CAAC,CAAA,EAAG,CAAA,KAAM,EAAE,QA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EACzD,EAAE,IAAA,EAAM,qBAAA,EAAuB,QAAA,EAAU,mBAAA,EAAoB;AAAA,EAC7D,EAAE,IAAA,EAAM,6BAAA,EAA+B,QAAA,EAAU,4BAAA,EAA6B;AAAA,EAC9E,EAAE,IAAA,EAAM,uBAAA,EAAyB,QAAA,EAAU,qBAAA;AAC7C,CAAC","file":"builtin.mjs","sourcesContent":["// errors.ts — PackError class (feat-20260513-guid-asset-package-system w15)\n//\n// Four-field surface: .code / .expected / .hint / .detail\n// Structurally parallel to AssetError / RhiError / RemoteError\n// (charter proposition 5 consistent abstraction).\n//\n// .detail is narrowed per .code via PackErrorDetail discriminated union\n// (requirements §6.2 AC-07; plan-strategy §D-5).\n\nimport type { PackErrorCode, PackErrorDetail } from '@forgeax/engine-types';\n\n/**\n * Structured error for the engine-pack disk scanner fail-fast chain.\n *\n * AI users consume via exhaustive switch on .code — no default case needed:\n * ```ts\n * switch (err.code) {\n * case 'pack-guid-collision':\n * console.error(err.detail.paths);\n * break;\n * case 'pack-cyclic-reference':\n * console.error(err.detail.cycle);\n * break;\n * // ...all 8 cases\n * }\n * ```\n */\nexport class PackError extends Error {\n readonly code: PackErrorCode;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PackErrorDetail;\n\n constructor(args: {\n code: PackErrorCode;\n expected: string;\n hint: string;\n detail: PackErrorDetail;\n }) {\n super(`[PackError ${args.code}] expected: ${args.expected}; hint: ${args.hint}`);\n this.name = 'PackError';\n this.code = args.code;\n this.expected = args.expected;\n this.hint = args.hint;\n this.detail = args.detail;\n }\n}\n","import { uuidv7obj } from 'uuidv7';\nimport { PackError } from './errors.js';\n\n/**\n * 16-byte UUID branded ABI. Prevents assignment from plain Uint8Array or string.\n * Brand field mirrors the declaration in @forgeax/engine-types for cross-package\n * structural compatibility (both use __guidBrand: 'AssetGuid').\n */\nexport type AssetGuid = Uint8Array & { readonly __guidBrand: 'AssetGuid' };\n\n/** Minimal Result alias for this module (structurally compatible with ScanResult). */\nexport type GuidResult<T, E> =\n | { readonly ok: true; readonly value: T }\n | { readonly ok: false; readonly error: E };\n\nfunction brand(bytes: Uint8Array): AssetGuid {\n return bytes as AssetGuid;\n}\n\nconst HEX_BYTE = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n\nfunction bytesToDashForm(bytes: Uint8Array): string {\n const h = HEX_BYTE;\n // biome-ignore lint/style/noNonNullAssertion: length guaranteed 16\n return `${h[bytes[0]!]}${h[bytes[1]!]}${h[bytes[2]!]}${h[bytes[3]!]}-${h[bytes[4]!]}${h[bytes[5]!]}-${h[bytes[6]!]}${h[bytes[7]!]}-${h[bytes[8]!]}${h[bytes[9]!]}-${h[bytes[10]!]}${h[bytes[11]!]}${h[bytes[12]!]}${h[bytes[13]!]}${h[bytes[14]!]}${h[bytes[15]!]}`;\n}\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport function isValidAssetGuidString(value: unknown): value is string {\n return typeof value === 'string' && UUID_RE.test(value);\n}\n\nfunction dashFormToBytes(dashForm: string): Uint8Array {\n const hex = dashForm.replace(/-/g, '');\n const bytes = new Uint8Array(16);\n for (let i = 0; i < 16; i++) {\n bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);\n }\n return bytes;\n}\n\n/**\n * Utilities for the AssetGuid branded 16-byte UUID type.\n * Declare the type via `import type { AssetGuid } from '@forgeax/engine-pack/guid'`\n * or `import type { AssetGuid } from '@forgeax/engine-types'`.\n */\nexport const AssetGuid = {\n /**\n * Parse a 36-char RFC 4122 dash-form UUID string into an AssetGuid.\n * Returns Ok(AssetGuid) on success or Err(PackError) with code 'pack-guid-malformed' on failure.\n * Never throws for expected failures (requirements §4.2 / §14 / charter proposition 4).\n */\n parse(dashForm: string): GuidResult<AssetGuid, PackError> {\n if (!isValidAssetGuidString(dashForm)) {\n return {\n ok: false,\n error: new PackError({\n code: 'pack-guid-malformed',\n expected: '36-char RFC 4122 dash-form UUID',\n hint: 'use AssetGuid.random() or a UUIDv7 generator; all GUID fields must be 36-char RFC 4122 dash-form',\n detail: {\n raw: dashForm,\n reason: 'expected 36-char RFC 4122 dash-form UUID',\n },\n }),\n };\n }\n return { ok: true, value: brand(dashFormToBytes(dashForm)) };\n },\n\n /**\n * Format an AssetGuid as a 36-char RFC 4122 lowercase dash-form string.\n */\n format(guid: AssetGuid): string {\n return bytesToDashForm(guid);\n },\n\n /**\n * Test byte-by-byte equality between two AssetGuids.\n */\n equals(a: AssetGuid, b: AssetGuid): boolean {\n for (let i = 0; i < 16; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n },\n\n /**\n * Mint a new time-ordered UUIDv7 as an AssetGuid.\n * Works in both Node.js and browser environments.\n */\n random(): AssetGuid {\n const uuid = uuidv7obj();\n const bytes = new Uint8Array(16);\n bytes.set(uuid.bytes);\n return brand(bytes);\n },\n} as const;\n","import type { AssetGuid } from './guid.js';\nimport { AssetGuid as AssetGuidNS } from './guid.js';\n\n/**\n * ForgeaX engine namespace UUID for UUIDv5 derivation.\n * Value: 9a09805a-7623-482e-b322-9fc3591f2a38\n * This is a custom namespace; it is intentionally NOT the RFC 4122 X.500 namespace.\n */\nconst _nsResult = AssetGuidNS.parse('9a09805a-7623-482e-b322-9fc3591f2a38');\nif (!_nsResult.ok) throw new Error('builtin: FORGEAX_NAMESPACE is not a valid UUID');\nexport const FORGEAX_NAMESPACE: AssetGuid = _nsResult.value;\n\n/**\n * Derive a stable UUIDv5 AssetGuid from a name within the ForgeaX namespace.\n * Uses SHA-1 via Node.js `node:crypto` or Web Crypto API (RFC 4122 §4.3).\n * Deterministic: same name always produces the same bytes.\n */\nexport async function deriveBuiltin(name: string): Promise<AssetGuid> {\n const nsBytes = FORGEAX_NAMESPACE;\n const nameBytes = new TextEncoder().encode(name);\n\n // Concatenate namespace bytes + name bytes for SHA-1 digest\n const concat = new Uint8Array(16 + nameBytes.length);\n concat.set(nsBytes, 0);\n concat.set(nameBytes, 16);\n\n let hashBytes: Uint8Array;\n\n if (typeof globalThis !== 'undefined' && globalThis.crypto?.subtle !== undefined) {\n // Browser / Web Crypto path\n const buffer = await globalThis.crypto.subtle.digest('SHA-1', concat);\n hashBytes = new Uint8Array(buffer);\n } else {\n // Node.js path\n const { createHash } = await import('node:crypto');\n const hash = createHash('sha1');\n hash.update(concat);\n hashBytes = hash.digest();\n }\n\n // RFC 4122 §4.3: assemble UUIDv5 from first 16 bytes of SHA-1 digest\n const uuidBytes = new Uint8Array(16);\n uuidBytes.set(hashBytes.subarray(0, 16));\n\n // Set version bits: byte 6, high nibble = 0x5 (version 5)\n // biome-ignore lint/style/noNonNullAssertion: uuidBytes is 16 bytes\n uuidBytes[6] = (uuidBytes[6]! & 0x0f) | 0x50;\n // Set variant bits: byte 8, high 2 bits = 0b10\n // biome-ignore lint/style/noNonNullAssertion: uuidBytes is 16 bytes\n uuidBytes[8] = (uuidBytes[8]! & 0x3f) | 0x80;\n\n return uuidBytes as AssetGuid;\n}\n\nfunction formatSync(bytes: Uint8Array): string {\n return AssetGuidNS.format(bytes as AssetGuid);\n}\n\nasync function deriveSync(name: string): Promise<string> {\n return formatSync(await deriveBuiltin(name));\n}\n\n/**\n * Pre-computed compile-time constant for the HANDLE_CUBE builtin GUID.\n * Derived from: deriveBuiltin('HANDLE_CUBE') under FORGEAX_NAMESPACE.\n */\nexport const BUILTIN_HANDLE_CUBE = await deriveSync('HANDLE_CUBE');\n\n/**\n * Pre-computed compile-time constant for the HANDLE_TRIANGLE builtin GUID.\n * Derived from: deriveBuiltin('HANDLE_TRIANGLE') under FORGEAX_NAMESPACE.\n */\nexport const BUILTIN_HANDLE_TRIANGLE = await deriveSync('HANDLE_TRIANGLE');\n\n/**\n * Pre-computed compile-time constant for the HANDLE_QUAD builtin GUID.\n * Derived from: deriveBuiltin('HANDLE_QUAD') under FORGEAX_NAMESPACE.\n */\nexport const BUILTIN_HANDLE_QUAD = await deriveSync('HANDLE_QUAD');\n\n/** Pre-computed UUIDv5 for the Engine-owned sphere mesh descriptor. */\nexport const BUILTIN_HANDLE_SPHERE = await deriveSync('HANDLE_SPHERE');\n\n/** Pre-computed UUIDv5 for the Engine-owned nine-slice quad descriptor. */\nexport const BUILTIN_HANDLE_NINESLICE_QUAD = await deriveSync('HANDLE_NINESLICE_QUAD');\n\n/** Pre-computed UUIDv5 for the Engine-owned cylinder mesh descriptor. */\nexport const BUILTIN_HANDLE_CYLINDER = await deriveSync('HANDLE_CYLINDER');\n\nexport type BuiltinMeshGeometry =\n | 'procedural-cube'\n | 'procedural-triangle'\n | 'procedural-quad'\n | 'procedural-sphere'\n | 'procedural-nine-slice-quad'\n | 'procedural-cylinder';\n\n/**\n * The complete Engine-owned procedural mesh catalog.\n *\n * These are Pack descriptors, not runtime payloads: the Geometry decoder\n * expands each `geometry` token into its validated MeshAsset. DevKit uses this\n * list to materialize only the descriptors a standalone project does not\n * already author, keeping the shipped game self-contained without duplicate\n * GUID declarations.\n */\nexport const BUILTIN_MESH_ASSETS: ReadonlyArray<{\n readonly guid: string;\n readonly geometry: BuiltinMeshGeometry;\n}> = Object.freeze([\n { guid: BUILTIN_HANDLE_CUBE, geometry: 'procedural-cube' },\n { guid: BUILTIN_HANDLE_TRIANGLE, geometry: 'procedural-triangle' },\n { guid: BUILTIN_HANDLE_QUAD, geometry: 'procedural-quad' },\n { guid: BUILTIN_HANDLE_SPHERE, geometry: 'procedural-sphere' },\n { guid: BUILTIN_HANDLE_NINESLICE_QUAD, geometry: 'procedural-nine-slice-quad' },\n { guid: BUILTIN_HANDLE_CYLINDER, geometry: 'procedural-cylinder' },\n]);\n"]}
@@ -0,0 +1,43 @@
1
+ import type { PackIndexEntry } from '@forgeax/engine-types';
2
+ import { type MetaInventoryDocument, type ScanOptions, type ScanSourceDeclaration } from './scanner.js';
3
+ type CatalogImportMeta = Pick<MetaInventoryDocument, 'importer' | 'packageId' | 'provenance' | 'revision' | 'diagnostics' | 'importSettings' | 'sourceOverrides' | 'subAssets'> & {
4
+ readonly source: string;
5
+ readonly sourceRevision?: string;
6
+ readonly buildPack?: boolean;
7
+ };
8
+ export type CatalogBuildErrorCode = 'catalog-meta-schema-invalid' | 'catalog-scan-failed' | 'catalog-raw-source-unsupported' | 'catalog-scriptable-pack-invalid' | 'catalog-host-kind-conflict';
9
+ export interface CatalogBuildError {
10
+ readonly code: CatalogBuildErrorCode;
11
+ readonly path: string;
12
+ readonly message: string;
13
+ readonly expected?: string;
14
+ readonly actual?: string;
15
+ readonly hint?: string;
16
+ readonly subjects?: readonly string[];
17
+ }
18
+ export type CatalogAuthority = 'authoritative' | 'degraded';
19
+ export interface CatalogBuildResult {
20
+ readonly schemaVersion: 'catalog-legacy-v1';
21
+ readonly entries: readonly PackIndexEntry[];
22
+ readonly authority: CatalogAuthority;
23
+ readonly diagnostics: readonly CatalogBuildError[];
24
+ readonly declarations: ReadonlyMap<string, CatalogImportMeta>;
25
+ readonly sourceDeclarations: ReadonlyMap<string, ScanSourceDeclaration>;
26
+ }
27
+ export type CatalogProducerVisibility = (input: Pick<MetaInventoryDocument, 'importer' | 'importSettings' | 'subAssets'>) => boolean;
28
+ export interface CatalogImporterPolicy {
29
+ readonly disposition: 'publish' | 'exclude' | 'missing';
30
+ readonly expected: string;
31
+ readonly hint: string;
32
+ readonly hostProvided: boolean;
33
+ }
34
+ export interface CatalogBuildProjectionOptions {
35
+ readonly base?: string;
36
+ readonly scanOptions?: ScanOptions;
37
+ readonly importerPolicy: (importer: string) => CatalogImporterPolicy;
38
+ readonly visibility?: CatalogProducerVisibility;
39
+ }
40
+ export declare function metaPathForGuid(declarations: ReadonlyMap<string, CatalogImportMeta>, guid: string): string | undefined;
41
+ export declare function buildCatalogProjection(roots: readonly string[], options: CatalogBuildProjectionOptions): Promise<CatalogBuildResult>;
42
+ export {};
43
+ //# sourceMappingURL=catalog-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-builder.d.ts","sourceRoot":"","sources":["../src/catal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AAE,SAAS,iBAAiB,EAAE,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9D,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CACzE;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,gBAAgB,GAAG,WAAW,CAAC,KAC5E,OAAO,CAAC;AAEb,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,qBAAqB,CAAC;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,yBAAyB,CAAC;CACjD;AAMD,wBAAgB,eAAe,CAC7B,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACpD,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAMpB;AA0JD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,kBAAkB,CAAC,CA+D7B"}
@@ -0,0 +1,11 @@
1
+ import type { CatalogDelta, CatalogRevisionWindow, PackIndexEntry } from '@forgeax/engine-types';
2
+ /**
3
+ * Derives one neutral delta from consecutive complete catalog projections.
4
+ *
5
+ * The returned fields are canonical POD fields: topology, revision continuity,
6
+ * authority, and diagnostics remain structured so AI consumers do not parse
7
+ * producer or transport messages. Degraded results intentionally contain no
8
+ * added, changed, or removed identity rows.
9
+ */
10
+ export declare function calculateCatalogDelta(previous: readonly PackIndexEntry[], next: readonly PackIndexEntry[], revision?: CatalogRevisionWindow): CatalogDelta | undefined;
11
+ //# sourceMappingURL=catalog-delta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-delta.d.ts","sourceRoot":"","sources":["../src/catalog-delta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,qBAAqB,EAErB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAiH/B;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,IAAI,EAAE,SAAS,cAAc,EAAE,EAC/B,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,YAAY,GAAG,SAAS,CAyD1B"}
@@ -0,0 +1,91 @@
1
+ import type { AssetAuthoringCapability, AssetPublicationEnvelope, CatalogDiagnostic, CatalogEntryV2, CatalogLifecycle, CatalogSubject, CookExecution, PackIndexEntry, ProducerContractResult, ProviderProvenance, ResourceRevision, SourceOverrideDescriptor } from '@forgeax/engine-types';
2
+ export declare function catalogProjectionFor(subject: 'internal-asset' | 'imported-output', execution: 'direct' | 'cooked', lifecycle: 'missing' | 'cooking' | 'current' | 'stale' | 'failed'): {
3
+ readonly subject: "internal-asset" | "imported-output";
4
+ readonly execution: "direct" | "cooked";
5
+ readonly lifecycle: "missing" | "cooking" | "current" | "stale" | "failed";
6
+ readonly operations: Readonly<Record<import("@forgeax/engine-types").CatalogOperationName, import("@forgeax/engine-types").CatalogOperationDescriptor>>;
7
+ };
8
+ export declare function currentProjectionFor(subject: 'internal-asset' | 'imported-output', execution: 'direct' | 'cooked'): {
9
+ readonly projection: {
10
+ readonly subject: "internal-asset" | "imported-output";
11
+ readonly execution: "direct" | "cooked";
12
+ readonly lifecycle: "missing" | "cooking" | "current" | "stale" | "failed";
13
+ readonly operations: Readonly<Record<import("@forgeax/engine-types").CatalogOperationName, import("@forgeax/engine-types").CatalogOperationDescriptor>>;
14
+ };
15
+ readonly subject: "internal-asset" | "imported-output";
16
+ readonly execution: "direct" | "cooked";
17
+ readonly lifecycle: "missing" | "cooking" | "current" | "stale" | "failed";
18
+ readonly operations: Readonly<Record<import("@forgeax/engine-types").CatalogOperationName, import("@forgeax/engine-types").CatalogOperationDescriptor>>;
19
+ };
20
+ export interface CatalogProducerMeta {
21
+ readonly schemaVersion: string | number;
22
+ readonly packageId?: string;
23
+ readonly provenance?: ProviderProvenance;
24
+ readonly revision?: ResourceRevision;
25
+ readonly diagnostics?: readonly CatalogDiagnostic[];
26
+ readonly provider?: string;
27
+ readonly importer?: string;
28
+ readonly sourceOverrides?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
29
+ readonly sourceOverrideDescriptors?: readonly SourceOverrideDescriptor[];
30
+ }
31
+ export interface CatalogOutputDeclaration {
32
+ readonly guid: string;
33
+ readonly kind: string;
34
+ readonly sourceKey?: string;
35
+ readonly sourceIndex?: number;
36
+ readonly relations?: PackIndexEntry['relations'];
37
+ readonly authoring?: AssetAuthoringCapability;
38
+ readonly refs?: readonly string[];
39
+ readonly name?: string;
40
+ }
41
+ /** Project producer declarations without interpreting a provider's kind vocabulary. */
42
+ export declare function projectExternalCatalogEntries(producer: CatalogProducerMeta, sourcePath: string, packageUrl: string, outputs: readonly CatalogOutputDeclaration[], nameFor?: (output: CatalogOutputDeclaration, index: number) => string | undefined): PackIndexEntry[];
43
+ /** Return the first declaration that would shadow an engine-owned Pack kind. */
44
+ export declare function findReservedAssetKindConflict(outputs: readonly Pick<CatalogOutputDeclaration, 'kind'>[]): Pick<CatalogOutputDeclaration, 'kind'> | undefined;
45
+ export interface PackageCatalogInput {
46
+ readonly guid: string;
47
+ readonly kind: string;
48
+ readonly sourcePath: string;
49
+ readonly name?: string;
50
+ readonly refs?: readonly string[];
51
+ readonly authoring?: AssetAuthoringCapability;
52
+ readonly execution?: 'direct' | 'cooked';
53
+ readonly packageId?: string;
54
+ readonly provenance?: ProviderProvenance;
55
+ readonly revision?: ResourceRevision;
56
+ readonly sourceKey?: string;
57
+ readonly sourceIndex?: number;
58
+ readonly sourceOverrides?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
59
+ readonly sourceOverrideDescriptors?: readonly SourceOverrideDescriptor[];
60
+ readonly relations?: PackIndexEntry['relations'];
61
+ readonly diagnostics?: readonly CatalogDiagnostic[];
62
+ readonly cookReceiptUrl?: string;
63
+ }
64
+ /** Project self-contained Pack rows into the same Catalog contract as producer output. */
65
+ export declare function projectPackageCatalog(entries: readonly PackageCatalogInput[], packageUrl: string): PackIndexEntry[];
66
+ export interface CookedPackageProjection {
67
+ readonly packageUrl: string;
68
+ readonly revision: ResourceRevision;
69
+ readonly refs: readonly string[];
70
+ readonly cookReceiptUrl?: string;
71
+ readonly publication?: AssetPublicationEnvelope;
72
+ }
73
+ /** Project one complete cooked package; navigation facts stay in the Pack owner. */
74
+ export declare function projectCookedPackageEntry(entry: PackIndexEntry, projection: CookedPackageProjection): PackIndexEntry;
75
+ export interface RuntimeCatalogRowInput {
76
+ readonly scopeId: string;
77
+ readonly generation: number;
78
+ readonly digest: string;
79
+ readonly outputSetDigest: string;
80
+ readonly guid: string;
81
+ readonly kind: string;
82
+ readonly packageUrl: string;
83
+ readonly sourcePath?: string;
84
+ readonly subject?: CatalogSubject;
85
+ readonly execution?: CookExecution;
86
+ readonly lifecycle?: CatalogLifecycle;
87
+ readonly publication?: unknown;
88
+ }
89
+ /** Project one row; an array is accepted only to fail closed on double rows. */
90
+ export declare function projectRuntimeCatalogRow(input: RuntimeCatalogRowInput | readonly RuntimeCatalogRowInput[]): ProducerContractResult<CatalogEntryV2>;
91
+ //# sourceMappingURL=catalog-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-projection.d.ts","sourceRoot":"","sources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