@forgeax/engine-pack 0.1.20 → 0.1.23

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 (128) hide show
  1. package/README.md +159 -46
  2. package/dist/__tests__/inventory-schema.test.d.ts +2 -0
  3. package/dist/__tests__/inventory-schema.test.d.ts.map +1 -0
  4. package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts +2 -0
  5. package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts.map +1 -0
  6. package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts +2 -0
  7. package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/parameterized-pack.unit.test.d.ts +2 -0
  9. package/dist/__tests__/parameterized-pack.unit.test.d.ts.map +1 -0
  10. package/dist/__tests__/scanner-blacklist.test.d.ts +2 -0
  11. package/dist/__tests__/scanner-blacklist.test.d.ts.map +1 -0
  12. package/dist/build.d.ts +9 -4
  13. package/dist/build.d.ts.map +1 -1
  14. package/dist/build.mjs +3317 -804
  15. package/dist/build.mjs.map +1 -1
  16. package/dist/builtin.mjs +37 -4
  17. package/dist/builtin.mjs.map +1 -1
  18. package/dist/catalog-builder.d.ts.map +1 -1
  19. package/dist/cli-asset.d.ts.map +1 -1
  20. package/dist/cli-asset.mjs +1368 -850
  21. package/dist/cli-asset.mjs.map +1 -1
  22. package/dist/deriveAssetName.d.ts +11 -7
  23. package/dist/deriveAssetName.d.ts.map +1 -1
  24. package/dist/evidence/material-cook.d.ts.map +1 -1
  25. package/dist/evidence/source-inventory.d.ts.map +1 -1
  26. package/dist/guid.d.ts +15 -0
  27. package/dist/guid.d.ts.map +1 -1
  28. package/dist/guid.mjs +53 -5
  29. package/dist/guid.mjs.map +1 -1
  30. package/dist/index.d.ts +3 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.mjs +1255 -561
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/inventory/binding.d.ts +6 -0
  35. package/dist/inventory/binding.d.ts.map +1 -0
  36. package/dist/inventory/declaration.d.ts +24 -0
  37. package/dist/inventory/declaration.d.ts.map +1 -0
  38. package/dist/inventory/index.d.ts +3 -0
  39. package/dist/inventory/index.d.ts.map +1 -0
  40. package/dist/inventory/sync.d.ts +5 -0
  41. package/dist/inventory/sync.d.ts.map +1 -0
  42. package/dist/material-cook.mjs +3 -1
  43. package/dist/material-cook.mjs.map +1 -1
  44. package/dist/name.mjs +4 -7
  45. package/dist/name.mjs.map +1 -1
  46. package/dist/package-finalizer.d.ts +2 -20
  47. package/dist/package-finalizer.d.ts.map +1 -1
  48. package/dist/parameterized-pack-node.d.ts +26 -0
  49. package/dist/parameterized-pack-node.d.ts.map +1 -0
  50. package/dist/parameterized-pack-node.mjs +11093 -0
  51. package/dist/parameterized-pack-node.mjs.map +1 -0
  52. package/dist/parameterized-pack.d.ts +233 -0
  53. package/dist/parameterized-pack.d.ts.map +1 -0
  54. package/dist/resolve-asset-source.d.ts +1 -3
  55. package/dist/resolve-asset-source.d.ts.map +1 -1
  56. package/dist/resolve-asset-source.mjs +6 -81
  57. package/dist/resolve-asset-source.mjs.map +1 -1
  58. package/dist/runtime.mjs +77 -7
  59. package/dist/runtime.mjs.map +1 -1
  60. package/dist/scanner.d.ts +19 -8
  61. package/dist/scanner.d.ts.map +1 -1
  62. package/dist/scanner.mjs +1169 -690
  63. package/dist/scanner.mjs.map +1 -1
  64. package/dist/schema-compiled.d.ts.map +1 -1
  65. package/dist/schema.mjs +79 -7
  66. package/dist/schema.mjs.map +1 -1
  67. package/dist/scriptable-pack-node.d.ts +8 -32
  68. package/dist/scriptable-pack-node.d.ts.map +1 -1
  69. package/dist/scriptable-pack-node.mjs +576 -1021
  70. package/dist/scriptable-pack-node.mjs.map +1 -1
  71. package/dist/scriptable-pack-worker.mjs +29 -11
  72. package/dist/scriptable-pack-worker.mjs.map +1 -1
  73. package/dist/scriptable-pack.d.ts +19 -532
  74. package/dist/scriptable-pack.d.ts.map +1 -1
  75. package/dist/scriptable-pack.mjs +1042 -527
  76. package/dist/scriptable-pack.mjs.map +1 -1
  77. package/package.json +7 -7
  78. package/schema/meta.schema.json +1 -1
  79. package/schema/pack.schema.json +76 -6
  80. package/src/__tests__/guid-collision.unit.test.ts +18 -9
  81. package/src/__tests__/inventory-schema.test.ts +109 -0
  82. package/src/__tests__/pack.unit.test.ts +1 -238
  83. package/src/__tests__/package-finalizer.contract.test.ts +55 -0
  84. package/src/__tests__/parameterized-pack-authoring-gateway.unit.test.ts +249 -0
  85. package/src/__tests__/parameterized-pack-scanner.unit.test.ts +123 -0
  86. package/src/__tests__/parameterized-pack.unit.test.ts +266 -0
  87. package/src/__tests__/resolve-asset-source.test.ts +15 -98
  88. package/src/__tests__/scanner-blacklist.test.ts +55 -0
  89. package/src/__tests__/scanner-inventory.contract.test.ts +14 -15
  90. package/src/__tests__/scanner-inventory.test.ts +24 -12
  91. package/src/__tests__/scriptable-pack-cli.integration.test.ts +4 -9
  92. package/src/__tests__/topology.unit.test.ts +23 -0
  93. package/src/build.ts +28 -18
  94. package/src/catalog-builder.ts +61 -34
  95. package/src/cli-asset.ts +70 -85
  96. package/src/deriveAssetName.ts +14 -13
  97. package/src/evidence/material-cook.ts +3 -1
  98. package/src/evidence/source-inventory.ts +34 -21
  99. package/src/guid.ts +65 -4
  100. package/src/index.ts +12 -11
  101. package/src/inventory/binding.ts +25 -0
  102. package/src/inventory/declaration.ts +168 -0
  103. package/src/inventory/index.ts +18 -0
  104. package/src/inventory/sync.ts +22 -0
  105. package/src/package-finalizer.ts +2 -42
  106. package/src/parameterized-pack-node.ts +1968 -0
  107. package/src/parameterized-pack.ts +1493 -0
  108. package/src/resolve-asset-source.ts +4 -76
  109. package/src/scanner.ts +241 -59
  110. package/src/schema-compiled.ts +2 -0
  111. package/src/scriptable-pack-node.ts +111 -722
  112. package/src/scriptable-pack-worker.ts +48 -16
  113. package/src/scriptable-pack.ts +27 -939
  114. package/dist/.tsbuildinfo +0 -1
  115. package/dist/__tests__/load-asset-config.test.d.ts +0 -2
  116. package/dist/__tests__/load-asset-config.test.d.ts.map +0 -1
  117. package/dist/__tests__/scriptable-pack.test-d.d.ts +0 -2
  118. package/dist/__tests__/scriptable-pack.test-d.d.ts.map +0 -1
  119. package/dist/__tests__/scriptable-pack.unit.test.d.ts +0 -2
  120. package/dist/__tests__/scriptable-pack.unit.test.d.ts.map +0 -1
  121. package/dist/config.d.ts +0 -6
  122. package/dist/config.d.ts.map +0 -1
  123. package/dist/config.mjs +0 -29
  124. package/dist/config.mjs.map +0 -1
  125. package/src/__tests__/load-asset-config.test.ts +0 -121
  126. package/src/__tests__/scriptable-pack.test-d.ts +0 -131
  127. package/src/__tests__/scriptable-pack.unit.test.ts +0 -789
  128. package/src/config.ts +0 -36
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { MATERIAL_TEXTURE_SLOTS, ok, projectCookProductEvidence, projectAssetEvidence, err, validateSourceOverrideMap } from '@forgeax/engine-types';
2
2
  import { sha256 } from '@noble/hashes/sha2.js';
3
3
  import { bytesToHex } from '@noble/hashes/utils.js';
4
+ import { sha1 } from '@noble/hashes/legacy.js';
4
5
  import { uuidv7obj } from 'uuidv7';
5
6
 
6
7
  var __create = Object.create;
@@ -4708,8 +4709,8 @@ var require_multipleOf = __commonJS({
4708
4709
  const { gen, data, schemaCode, it } = cxt;
4709
4710
  const prec = it.opts.multipleOfPrecision;
4710
4711
  const res = gen.let("res");
4711
- const invalid4 = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
4712
- cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid4}))`);
4712
+ const invalid3 = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
4713
+ cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid3}))`);
4713
4714
  }
4714
4715
  };
4715
4716
  exports.default = def;
@@ -6834,7 +6835,9 @@ function textureValues(values, textureFields) {
6834
6835
  }
6835
6836
  function collectMaterialCookRefs(material) {
6836
6837
  const textureFields = material.parameters === void 0 ? new Set(MATERIAL_TEXTURE_SLOTS) : new Set(
6837
- material.parameters.filter((parameter) => parameter.type === "texture").map((parameter) => parameter.name)
6838
+ material.parameters.filter(
6839
+ (parameter) => parameter.type === "texture" || parameter.type === "texture_cube"
6840
+ ).map((parameter) => parameter.name)
6838
6841
  );
6839
6842
  const textures = textureValues(material.values, textureFields);
6840
6843
  return {
@@ -6894,14 +6897,14 @@ function serializeCookedMaterialRecord(record) {
6894
6897
  function serializeMaterialCookReceipt(receipt) {
6895
6898
  return JSON.stringify(jsonValue({ ...receipt, sourceClosure: unique(receipt.sourceClosure) }));
6896
6899
  }
6897
- function invalid(field, actual2) {
6900
+ function invalid(field, actual) {
6898
6901
  return err({
6899
6902
  code: "material-cook-record-invalid",
6900
6903
  expected: "a complete material-cook/3 record with layered identity and provenance",
6901
6904
  hint: "re-cook the material and publish its record, artifact, references, and receipt together",
6902
6905
  detail: {
6903
6906
  field,
6904
- ...actual2 === void 0 ? {} : { actual: actual2 },
6907
+ ...actual === void 0 ? {} : { actual },
6905
6908
  action: "inspect the named field and recook the material generation"
6906
6909
  }
6907
6910
  });
@@ -7093,12 +7096,146 @@ function packageVerification(input) {
7093
7096
  };
7094
7097
  }
7095
7098
 
7099
+ // src/errors.ts
7100
+ var PackError = class extends Error {
7101
+ code;
7102
+ expected;
7103
+ hint;
7104
+ detail;
7105
+ constructor(args) {
7106
+ super(`[PackError ${args.code}] expected: ${args.expected}; hint: ${args.hint}`);
7107
+ this.name = "PackError";
7108
+ this.code = args.code;
7109
+ this.expected = args.expected;
7110
+ this.hint = args.hint;
7111
+ this.detail = args.detail;
7112
+ }
7113
+ };
7114
+
7115
+ // src/guid.ts
7116
+ function brand(bytes) {
7117
+ return bytes;
7118
+ }
7119
+ var HEX_BYTE = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
7120
+ function bytesToDashForm(bytes) {
7121
+ const h = HEX_BYTE;
7122
+ 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]]}`;
7123
+ }
7124
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7125
+ var PACK_SOURCE_KEY_RE = /^[a-z0-9][a-z0-9._-]*(\/[a-z0-9][a-z0-9._-]*)*$/;
7126
+ function isValidPackSourceKey(value) {
7127
+ return typeof value === "string" && PACK_SOURCE_KEY_RE.test(value);
7128
+ }
7129
+ function isValidAssetGuidString(value) {
7130
+ return typeof value === "string" && UUID_RE.test(value);
7131
+ }
7132
+ function dashFormToBytes(dashForm) {
7133
+ const hex = dashForm.replace(/-/g, "");
7134
+ const bytes = new Uint8Array(16);
7135
+ for (let i = 0; i < 16; i++) {
7136
+ bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
7137
+ }
7138
+ return bytes;
7139
+ }
7140
+ function randomUuidBytes() {
7141
+ const uuid = uuidv7obj();
7142
+ const bytes = new Uint8Array(16);
7143
+ bytes.set(uuid.bytes);
7144
+ return bytes;
7145
+ }
7146
+ function packageId(value) {
7147
+ return value;
7148
+ }
7149
+ var PackageId = {
7150
+ parse(dashForm) {
7151
+ const parsed = AssetGuid.parse(dashForm);
7152
+ return parsed.ok ? { ok: true, value: packageId(parsed.value) } : parsed;
7153
+ },
7154
+ format(value) {
7155
+ return bytesToDashForm(value);
7156
+ },
7157
+ random() {
7158
+ return packageId(randomUuidBytes());
7159
+ }
7160
+ };
7161
+ function derivedGuid(namespace, sourceKey2) {
7162
+ if (!(namespace instanceof Uint8Array) || namespace.byteLength !== 16) {
7163
+ throw new TypeError("AssetGuid.derive requires a 16-byte PackageId");
7164
+ }
7165
+ if (!isValidPackSourceKey(sourceKey2)) {
7166
+ const error = new TypeError(
7167
+ `AssetGuid.derive received invalid sourceKey ${JSON.stringify(sourceKey2)}`
7168
+ );
7169
+ Object.defineProperty(error, "code", { value: "pack-source-key-invalid" });
7170
+ throw error;
7171
+ }
7172
+ const name = new TextEncoder().encode(sourceKey2);
7173
+ const input = new Uint8Array(namespace.byteLength + name.byteLength);
7174
+ input.set(namespace, 0);
7175
+ input.set(name, namespace.byteLength);
7176
+ const digest = sha1(input);
7177
+ const result = digest.slice(0, 16);
7178
+ result[6] = (result[6] ?? 0) & 15 | 80;
7179
+ result[8] = (result[8] ?? 0) & 63 | 128;
7180
+ return brand(result);
7181
+ }
7182
+ var AssetGuid = {
7183
+ /**
7184
+ * Parse a 36-char RFC 4122 dash-form UUID string into an AssetGuid.
7185
+ * Returns Ok(AssetGuid) on success or Err(PackError) with code 'pack-guid-malformed' on failure.
7186
+ * Never throws for expected failures (requirements §4.2 / §14 / charter proposition 4).
7187
+ */
7188
+ parse(dashForm) {
7189
+ if (!isValidAssetGuidString(dashForm)) {
7190
+ return {
7191
+ ok: false,
7192
+ error: new PackError({
7193
+ code: "pack-guid-malformed",
7194
+ expected: "36-char RFC 4122 dash-form UUID",
7195
+ hint: "use AssetGuid.random() or a UUIDv7 generator; all GUID fields must be 36-char RFC 4122 dash-form",
7196
+ detail: {
7197
+ raw: dashForm,
7198
+ reason: "expected 36-char RFC 4122 dash-form UUID"
7199
+ }
7200
+ })
7201
+ };
7202
+ }
7203
+ return { ok: true, value: brand(dashFormToBytes(dashForm)) };
7204
+ },
7205
+ /**
7206
+ * Format an AssetGuid as a 36-char RFC 4122 lowercase dash-form string.
7207
+ */
7208
+ format(guid) {
7209
+ return bytesToDashForm(guid);
7210
+ },
7211
+ /**
7212
+ * Test byte-by-byte equality between two AssetGuids.
7213
+ */
7214
+ equals(a, b) {
7215
+ for (let i = 0; i < 16; i++) {
7216
+ if (a[i] !== b[i]) return false;
7217
+ }
7218
+ return true;
7219
+ },
7220
+ /**
7221
+ * Mint a new time-ordered UUIDv7 as an AssetGuid.
7222
+ * Works in both Node.js and browser environments.
7223
+ */
7224
+ random() {
7225
+ return brand(randomUuidBytes());
7226
+ },
7227
+ /** Derive the stable UUIDv5 projection for one Pack subject and sourceKey. */
7228
+ derive(namespace, sourceKey2) {
7229
+ return derivedGuid(namespace, sourceKey2);
7230
+ }
7231
+ };
7232
+
7096
7233
  // src/mesh-bin-contract.ts
7097
7234
  var MESH_BIN_VERSION = 4;
7098
7235
  var MESH_BIN_PROJECTION_VERSION = 1;
7099
7236
  var MESH_BIN_HEADER_V4_BYTES = 80;
7100
7237
  var MESH_BIN_DIGEST_BYTES = 32;
7101
- function failure(code, sourceKey2, expected, actual2) {
7238
+ function failure(code, sourceKey2, expected, actual) {
7102
7239
  return {
7103
7240
  ok: false,
7104
7241
  error: {
@@ -7106,7 +7243,7 @@ function failure(code, sourceKey2, expected, actual2) {
7106
7243
  subject: "mesh-bin",
7107
7244
  sourceKey: sourceKey2,
7108
7245
  expected,
7109
- actual: actual2,
7246
+ actual,
7110
7247
  recovery: "re-cook the source with its Meta sidecar through the build-time importer"
7111
7248
  }
7112
7249
  };
@@ -7185,41 +7322,1037 @@ function decodeMeshBinHeader(bytes, sourceKey2 = "<unknown mesh source>") {
7185
7322
  }
7186
7323
  };
7187
7324
  }
7188
- function isRecord(value) {
7325
+ var PACK_PARAMETER_TYPES = [
7326
+ "bool",
7327
+ "u32",
7328
+ "i32",
7329
+ "f32",
7330
+ "f64",
7331
+ "string",
7332
+ "enum",
7333
+ "vec2",
7334
+ "vec3",
7335
+ "vec4",
7336
+ "color",
7337
+ "asset-guid"
7338
+ ];
7339
+ function authoringError(code, expected, hint, detail = {}, actual) {
7340
+ return {
7341
+ code,
7342
+ expected,
7343
+ hint,
7344
+ ...actual === void 0 ? {} : { actual },
7345
+ detail
7346
+ };
7347
+ }
7348
+ function failure2(error) {
7349
+ return err(error);
7350
+ }
7351
+ function isRecord(value) {
7352
+ return value !== null && typeof value === "object" && !Array.isArray(value);
7353
+ }
7354
+ function validateSceneComponents(value) {
7355
+ if (value === void 0) return ok(void 0);
7356
+ if (!Array.isArray(value)) {
7357
+ return failure2(
7358
+ parameterFailure(
7359
+ "$.sceneComponents",
7360
+ "an array of component schema records",
7361
+ value,
7362
+ "sceneComponents is not an array"
7363
+ )
7364
+ );
7365
+ }
7366
+ const components = [];
7367
+ const names = /* @__PURE__ */ new Set();
7368
+ for (const [componentIndex, candidate] of value.entries()) {
7369
+ if (!isRecord(candidate) || typeof candidate.name !== "string" || !isRecord(candidate.fields)) {
7370
+ return failure2(
7371
+ parameterFailure(
7372
+ `$.sceneComponents[${componentIndex}]`,
7373
+ "a component record with name and fields",
7374
+ candidate,
7375
+ "scene component schema is malformed"
7376
+ )
7377
+ );
7378
+ }
7379
+ if (candidate.name.length === 0 || names.has(candidate.name)) {
7380
+ return failure2(
7381
+ parameterFailure(
7382
+ `$.sceneComponents[${componentIndex}].name`,
7383
+ "a non-empty unique component name",
7384
+ candidate.name,
7385
+ "scene component names must be unique"
7386
+ )
7387
+ );
7388
+ }
7389
+ names.add(candidate.name);
7390
+ const fields = {};
7391
+ for (const [fieldName, field] of Object.entries(candidate.fields)) {
7392
+ if (typeof field === "string" && field.length === 0 || typeof field !== "string" && (!isRecord(field) || typeof field.type !== "string" || field.type.length === 0)) {
7393
+ return failure2(
7394
+ parameterFailure(
7395
+ `$.sceneComponents[${componentIndex}].fields.${fieldName}`,
7396
+ "a field type string or { type: string }",
7397
+ field,
7398
+ "scene component field schema is malformed"
7399
+ )
7400
+ );
7401
+ }
7402
+ fields[fieldName] = field;
7403
+ }
7404
+ components.push({ name: candidate.name, fields });
7405
+ }
7406
+ return ok(components);
7407
+ }
7408
+ function isPackageId(value) {
7409
+ return value instanceof Uint8Array && value.byteLength === 16;
7410
+ }
7411
+ function cloneValue(value) {
7412
+ if (value instanceof Uint8Array) return value.slice();
7413
+ if (Array.isArray(value)) return value.map((item) => cloneValue(item));
7414
+ return value;
7415
+ }
7416
+ function sourceKeyFailure(sourceKey2, propertyPath = "$.sourceKey") {
7417
+ return authoringError(
7418
+ "pack-source-key-invalid",
7419
+ "a sourceKey matching ^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*$",
7420
+ "use a stable lower-case semantic key; do not derive it from file paths or output order",
7421
+ { propertyPath, sourceKey: sourceKey2 },
7422
+ typeof sourceKey2 === "string" ? sourceKey2 : void 0
7423
+ );
7424
+ }
7425
+ function parameterFailure(propertyPath, expected, actual, reason) {
7426
+ return authoringError(
7427
+ "pack-parameter-invalid",
7428
+ expected,
7429
+ "repair the parameter declaration or the instance values, then inspect and rebuild",
7430
+ { propertyPath, reason, actual: typeof actual === "string" ? actual : JSON.stringify(actual) }
7431
+ );
7432
+ }
7433
+ function numericType(type) {
7434
+ return type === "u32" || type === "i32" || type === "f32" || type === "f64";
7435
+ }
7436
+ function vectorLength(type) {
7437
+ switch (type) {
7438
+ case "vec2":
7439
+ return 2;
7440
+ case "vec3":
7441
+ return 3;
7442
+ case "vec4":
7443
+ case "color":
7444
+ return 4;
7445
+ default:
7446
+ return void 0;
7447
+ }
7448
+ }
7449
+ function parameterValueError(parameter, value, propertyPath) {
7450
+ const { type } = parameter;
7451
+ if (type === "bool" && typeof value !== "boolean") {
7452
+ return parameterFailure(propertyPath, "a boolean", value, "bool value has the wrong type");
7453
+ }
7454
+ if (numericType(type)) {
7455
+ if (typeof value !== "number" || !Number.isFinite(value)) {
7456
+ return parameterFailure(
7457
+ propertyPath,
7458
+ "a finite number",
7459
+ value,
7460
+ "numeric value is not finite"
7461
+ );
7462
+ }
7463
+ if ((type === "u32" || type === "i32") && !Number.isInteger(value)) {
7464
+ return parameterFailure(
7465
+ propertyPath,
7466
+ "an integer",
7467
+ value,
7468
+ "integer parameter received a fraction"
7469
+ );
7470
+ }
7471
+ if (type === "u32" && (value < 0 || value > 4294967295)) {
7472
+ return parameterFailure(
7473
+ propertyPath,
7474
+ "an unsigned 32-bit integer",
7475
+ value,
7476
+ "u32 value is outside [0, 2^32 - 1]"
7477
+ );
7478
+ }
7479
+ if (type === "i32" && (value < -2147483648 || value > 2147483647)) {
7480
+ return parameterFailure(
7481
+ propertyPath,
7482
+ "a signed 32-bit integer",
7483
+ value,
7484
+ "i32 value is outside [-2^31, 2^31 - 1]"
7485
+ );
7486
+ }
7487
+ if (type === "f32" && !Number.isFinite(Math.fround(value))) {
7488
+ return parameterFailure(
7489
+ propertyPath,
7490
+ "a finite IEEE-754 32-bit float",
7491
+ value,
7492
+ "f32 value overflows binary32"
7493
+ );
7494
+ }
7495
+ if (parameter.minimum !== void 0 && value < parameter.minimum) {
7496
+ return parameterFailure(
7497
+ propertyPath,
7498
+ `a number >= ${parameter.minimum}`,
7499
+ value,
7500
+ "value is below minimum"
7501
+ );
7502
+ }
7503
+ if (parameter.maximum !== void 0 && value > parameter.maximum) {
7504
+ return parameterFailure(
7505
+ propertyPath,
7506
+ `a number <= ${parameter.maximum}`,
7507
+ value,
7508
+ "value is above maximum"
7509
+ );
7510
+ }
7511
+ return void 0;
7512
+ }
7513
+ if (type === "string" && typeof value !== "string") {
7514
+ return parameterFailure(propertyPath, "a string", value, "string parameter has the wrong type");
7515
+ }
7516
+ if (type === "enum") {
7517
+ if (typeof value !== "string") {
7518
+ return parameterFailure(
7519
+ propertyPath,
7520
+ "one of the declared enum strings",
7521
+ value,
7522
+ "enum value has the wrong type"
7523
+ );
7524
+ }
7525
+ if (parameter.values === void 0 || !parameter.values.includes(value)) {
7526
+ return parameterFailure(
7527
+ propertyPath,
7528
+ "one of the declared enum values",
7529
+ value,
7530
+ "enum value is not declared"
7531
+ );
7532
+ }
7533
+ return void 0;
7534
+ }
7535
+ const length = vectorLength(type);
7536
+ if (length !== void 0) {
7537
+ if (!Array.isArray(value) || value.length !== length || value.some((component) => typeof component !== "number" || !Number.isFinite(component))) {
7538
+ return parameterFailure(
7539
+ propertyPath,
7540
+ `a finite numeric vector with ${length} components`,
7541
+ value,
7542
+ "vector value has the wrong shape"
7543
+ );
7544
+ }
7545
+ if (type === "color" && value.some((component) => component < 0 || component > 1)) {
7546
+ return parameterFailure(
7547
+ propertyPath,
7548
+ "an RGBA color with components in [0, 1]",
7549
+ value,
7550
+ "color component is outside [0, 1]"
7551
+ );
7552
+ }
7553
+ return void 0;
7554
+ }
7555
+ if (type === "asset-guid") {
7556
+ const validString = typeof value === "string" && isValidAssetGuidString(value);
7557
+ if (!(value instanceof Uint8Array && value.byteLength === 16) && !validString) {
7558
+ return parameterFailure(
7559
+ propertyPath,
7560
+ "a 16-byte AssetGuid or UUID string",
7561
+ value,
7562
+ "asset GUID value is malformed"
7563
+ );
7564
+ }
7565
+ return void 0;
7566
+ }
7567
+ return parameterFailure(
7568
+ propertyPath,
7569
+ "a supported Pack parameter type",
7570
+ value,
7571
+ "unknown parameter type"
7572
+ );
7573
+ }
7574
+ function normalizeParameterValue(parameter, value, propertyPath) {
7575
+ const error = parameterValueError(parameter, value, propertyPath);
7576
+ if (error !== void 0) return failure2(error);
7577
+ if (parameter.type === "asset-guid" && typeof value === "string") {
7578
+ const parsed = AssetGuid.parse(value);
7579
+ if (!parsed.ok) {
7580
+ return failure2(
7581
+ parameterFailure(
7582
+ propertyPath,
7583
+ "a valid AssetGuid UUID string",
7584
+ value,
7585
+ "asset GUID parser rejected the value"
7586
+ )
7587
+ );
7588
+ }
7589
+ return ok(parsed.value);
7590
+ }
7591
+ return ok(cloneValue(value));
7592
+ }
7593
+ function validateParameterDefinitions(parameters, propertyPath = "$.parameters") {
7594
+ if (!Array.isArray(parameters) || parameters.length === 0) {
7595
+ return failure2(
7596
+ parameterFailure(
7597
+ propertyPath,
7598
+ "a non-empty parameter descriptor array",
7599
+ parameters,
7600
+ "parameters must be explicit and non-empty"
7601
+ )
7602
+ );
7603
+ }
7604
+ const names = /* @__PURE__ */ new Set();
7605
+ const normalized = [];
7606
+ for (const [index, candidate] of parameters.entries()) {
7607
+ const path = `${propertyPath}[${index}]`;
7608
+ if (!isRecord(candidate))
7609
+ return failure2(
7610
+ parameterFailure(
7611
+ path,
7612
+ "a parameter descriptor object",
7613
+ candidate,
7614
+ "descriptor is not an object"
7615
+ )
7616
+ );
7617
+ const name = candidate.name;
7618
+ if (typeof name !== "string" || !/^[A-Za-z][A-Za-z0-9_.-]*$/.test(name)) {
7619
+ return failure2(
7620
+ parameterFailure(
7621
+ `${path}.name`,
7622
+ "a unique identifier-like parameter name",
7623
+ name,
7624
+ "parameter name is invalid"
7625
+ )
7626
+ );
7627
+ }
7628
+ if (names.has(name))
7629
+ return failure2(
7630
+ parameterFailure(
7631
+ `${path}.name`,
7632
+ "a unique parameter name",
7633
+ name,
7634
+ "parameter name is duplicated"
7635
+ )
7636
+ );
7637
+ names.add(name);
7638
+ const unknown = Object.keys(candidate).find(
7639
+ (key) => !["name", "type", "default", "minimum", "maximum", "values", "kind"].includes(key)
7640
+ );
7641
+ if (unknown !== void 0) {
7642
+ return failure2(
7643
+ parameterFailure(
7644
+ `${path}.${unknown}`,
7645
+ "only name, type, default, minimum, maximum, values, and kind fields",
7646
+ candidate[unknown],
7647
+ "parameter descriptors are a closed authoring schema"
7648
+ )
7649
+ );
7650
+ }
7651
+ const type = candidate.type;
7652
+ if (typeof type !== "string" || !PACK_PARAMETER_TYPES.includes(type)) {
7653
+ return failure2(
7654
+ parameterFailure(
7655
+ `${path}.type`,
7656
+ PACK_PARAMETER_TYPES.join(" | "),
7657
+ type,
7658
+ "parameter type is not supported"
7659
+ )
7660
+ );
7661
+ }
7662
+ const typed = {
7663
+ ...candidate,
7664
+ name,
7665
+ type
7666
+ };
7667
+ if (typed.values !== void 0) {
7668
+ if (typed.type !== "enum" || !Array.isArray(typed.values) || typed.values.length === 0 || typed.values.some((item) => typeof item !== "string") || new Set(typed.values).size !== typed.values.length) {
7669
+ return failure2(
7670
+ parameterFailure(
7671
+ `${path}.values`,
7672
+ "unique non-empty strings for enum",
7673
+ typed.values,
7674
+ "enum values are malformed"
7675
+ )
7676
+ );
7677
+ }
7678
+ } else if (typed.type === "enum") {
7679
+ return failure2(
7680
+ parameterFailure(
7681
+ `${path}.values`,
7682
+ "a non-empty enum choices array",
7683
+ typed.values,
7684
+ "enum has no choices"
7685
+ )
7686
+ );
7687
+ }
7688
+ if (typed.kind !== void 0 && (typed.type !== "asset-guid" || typeof typed.kind !== "string")) {
7689
+ return failure2(
7690
+ parameterFailure(
7691
+ `${path}.kind`,
7692
+ "a kind constraint only on asset-guid parameters",
7693
+ typed.kind,
7694
+ "kind is misplaced"
7695
+ )
7696
+ );
7697
+ }
7698
+ for (const field of ["minimum", "maximum"]) {
7699
+ const bound = typed[field];
7700
+ if (bound !== void 0 && (typeof bound !== "number" || !Number.isFinite(bound))) {
7701
+ return failure2(
7702
+ parameterFailure(
7703
+ `${path}.${field}`,
7704
+ "a finite numeric bound",
7705
+ bound,
7706
+ "numeric bound is invalid"
7707
+ )
7708
+ );
7709
+ }
7710
+ }
7711
+ if (!numericType(typed.type) && (typed.minimum !== void 0 || typed.maximum !== void 0)) {
7712
+ return failure2(
7713
+ parameterFailure(
7714
+ path,
7715
+ "minimum/maximum only on numeric parameters",
7716
+ typed,
7717
+ "numeric bounds are not meaningful for this parameter type"
7718
+ )
7719
+ );
7720
+ }
7721
+ if (typed.minimum !== void 0 && typed.maximum !== void 0 && typed.minimum > typed.maximum) {
7722
+ return failure2(
7723
+ parameterFailure(path, "minimum <= maximum", typed, "numeric bounds are reversed")
7724
+ );
7725
+ }
7726
+ const defaultResult = normalizeParameterValue(typed, typed.default, `${path}.default`);
7727
+ if (!defaultResult.ok) return defaultResult;
7728
+ normalized.push({
7729
+ ...typed,
7730
+ default: defaultResult.value,
7731
+ ...typed.values === void 0 ? {} : { values: Object.freeze([...typed.values]) }
7732
+ });
7733
+ }
7734
+ return ok(Object.freeze(normalized));
7735
+ }
7736
+ function definePackageId(value) {
7737
+ if (isPackageId(value)) return value.slice();
7738
+ const parsed = PackageId.parse(value);
7739
+ if (!parsed.ok) {
7740
+ const error = authoringError(
7741
+ "pack-package-id-invalid",
7742
+ "a 36-character RFC 4122 UUID packageId",
7743
+ "use PackageId.random() or repair the packageId literal before loading the Pack",
7744
+ { value },
7745
+ value
7746
+ );
7747
+ throw Object.assign(new TypeError(error.hint), error);
7748
+ }
7749
+ return parsed.value;
7750
+ }
7751
+ function cloneDefinition(definition) {
7752
+ const parameters = "parameters" in definition ? Object.freeze(
7753
+ definition.parameters.map(
7754
+ (parameter) => Object.freeze({
7755
+ ...parameter,
7756
+ default: cloneValue(parameter.default),
7757
+ ...parameter.values === void 0 ? {} : { values: Object.freeze(parameter.values.map((value) => cloneValue(value))) }
7758
+ })
7759
+ )
7760
+ ) : void 0;
7761
+ const sceneComponents = definition.sceneComponents === void 0 ? void 0 : Object.freeze(
7762
+ definition.sceneComponents.map(
7763
+ (component) => Object.freeze({
7764
+ name: component.name,
7765
+ fields: Object.freeze({ ...component.fields })
7766
+ })
7767
+ )
7768
+ );
7769
+ return Object.freeze({
7770
+ ...definition,
7771
+ packageId: definition.packageId.slice(),
7772
+ ...parameters === void 0 ? {} : { parameters },
7773
+ ...sceneComponents === void 0 ? {} : { sceneComponents }
7774
+ });
7775
+ }
7776
+ function definePack(definition) {
7777
+ const validated = validatePackDefinition(definition);
7778
+ if (!validated.ok) throw Object.assign(new TypeError(validated.error.hint), validated.error);
7779
+ return cloneDefinition(
7780
+ validated.value
7781
+ );
7782
+ }
7783
+ function projectParameterizedPackMeta(definition, sourcePath) {
7784
+ return {
7785
+ schemaVersion: "2.0.0",
7786
+ kind: "parameterized-pack-source",
7787
+ packageId: PackageId.format(definition.packageId),
7788
+ source: sourcePath,
7789
+ ..."parameters" in definition ? {
7790
+ parameters: definition.parameters.map((parameter) => ({
7791
+ name: parameter.name,
7792
+ type: parameter.type,
7793
+ default: jsonParameterValue(parameter.default),
7794
+ ...parameter.minimum === void 0 ? {} : { minimum: parameter.minimum },
7795
+ ...parameter.maximum === void 0 ? {} : { maximum: parameter.maximum },
7796
+ ...parameter.values === void 0 ? {} : { values: parameter.values },
7797
+ ...parameter.kind === void 0 ? {} : { kind: parameter.kind }
7798
+ }))
7799
+ } : {}
7800
+ };
7801
+ }
7802
+ function jsonParameterValue(value) {
7803
+ return value instanceof Uint8Array ? AssetGuid.format(value) : value;
7804
+ }
7805
+ function validatePackDefinition(value, sourcePath) {
7806
+ if (!isRecord(value))
7807
+ return failure2(
7808
+ parameterFailure("$", "a Pack definition object", value, "definition is not an object")
7809
+ );
7810
+ const unknown = Object.keys(value).find(
7811
+ (key) => !["schemaVersion", "packageId", "name", "parameters", "sceneComponents", "build"].includes(
7812
+ key
7813
+ )
7814
+ );
7815
+ if (unknown !== void 0) {
7816
+ return failure2(
7817
+ parameterFailure(
7818
+ `$.${unknown}`,
7819
+ "only schemaVersion, packageId, name, parameters, sceneComponents, and build fields",
7820
+ value[unknown],
7821
+ "legacy static output declarations and external asset tables are not part of v2 authoring"
7822
+ )
7823
+ );
7824
+ }
7825
+ if (value.schemaVersion !== "2.0.0") {
7826
+ return failure2(
7827
+ parameterFailure(
7828
+ "$.schemaVersion",
7829
+ "the literal '2.0.0'",
7830
+ value.schemaVersion,
7831
+ "authoring source schema is unsupported"
7832
+ )
7833
+ );
7834
+ }
7835
+ if (!isPackageId(value.packageId)) {
7836
+ return failure2(
7837
+ authoringError(
7838
+ "pack-package-id-invalid",
7839
+ "a 16-byte PackageId",
7840
+ "use definePackageId() for the stable source identity",
7841
+ { sourcePath, propertyPath: "$.packageId" },
7842
+ typeof value.packageId === "string" ? value.packageId : void 0
7843
+ )
7844
+ );
7845
+ }
7846
+ if (value.name !== void 0 && typeof value.name !== "string") {
7847
+ return failure2(
7848
+ parameterFailure("$.name", "a string when present", value.name, "display name is malformed")
7849
+ );
7850
+ }
7851
+ if (typeof value.build !== "function") {
7852
+ return failure2(
7853
+ parameterFailure("$.build", "a build function", value.build, "build is not callable")
7854
+ );
7855
+ }
7856
+ const sceneComponents = validateSceneComponents(value.sceneComponents);
7857
+ if (!sceneComponents.ok) return sceneComponents;
7858
+ const hasParameters = Object.hasOwn(value, "parameters");
7859
+ if (!hasParameters) {
7860
+ return ok(
7861
+ Object.freeze({
7862
+ schemaVersion: "2.0.0",
7863
+ packageId: value.packageId,
7864
+ ...value.name === void 0 ? {} : { name: value.name },
7865
+ ...sceneComponents.value === void 0 ? {} : { sceneComponents: sceneComponents.value },
7866
+ build: value.build
7867
+ })
7868
+ );
7869
+ }
7870
+ const parameters = validateParameterDefinitions(value.parameters);
7871
+ if (!parameters.ok) return parameters;
7872
+ return ok(
7873
+ Object.freeze({
7874
+ schemaVersion: "2.0.0",
7875
+ packageId: value.packageId,
7876
+ ...value.name === void 0 ? {} : { name: value.name },
7877
+ ...sceneComponents.value === void 0 ? {} : { sceneComponents: sceneComponents.value },
7878
+ parameters: parameters.value,
7879
+ build: value.build
7880
+ })
7881
+ );
7882
+ }
7883
+ function isParameterizedPack(value) {
7884
+ return isRecord(value) && Array.isArray(value.parameters) && value.parameters.length > 0;
7885
+ }
7886
+ function resolvePackParameterValues(definition, overrides = {}, inheritedValues) {
7887
+ if (!isRecord(overrides)) {
7888
+ return failure2(
7889
+ parameterFailure(
7890
+ "$.values",
7891
+ "an object of sparse parameter overrides",
7892
+ overrides,
7893
+ "values is not an object"
7894
+ )
7895
+ );
7896
+ }
7897
+ const descriptors = new Map(
7898
+ definition.parameters.map((parameter) => [parameter.name, parameter])
7899
+ );
7900
+ for (const name of Object.keys(overrides)) {
7901
+ if (!descriptors.has(name)) {
7902
+ return failure2(
7903
+ parameterFailure(
7904
+ `$.values.${name}`,
7905
+ "a declared parameter name",
7906
+ name,
7907
+ "instance contains an unknown parameter"
7908
+ )
7909
+ );
7910
+ }
7911
+ }
7912
+ const values = {};
7913
+ for (const parameter of definition.parameters) {
7914
+ const raw = Object.hasOwn(overrides, parameter.name) ? overrides[parameter.name] : inheritedValues?.[parameter.name] ?? parameter.default;
7915
+ const normalized = normalizeParameterValue(parameter, raw, `$.values.${parameter.name}`);
7916
+ if (!normalized.ok) return normalized;
7917
+ values[parameter.name] = normalized.value;
7918
+ }
7919
+ return ok(Object.freeze(values));
7920
+ }
7921
+ function jsonError(propertyPath, expected, actual, reason) {
7922
+ return failure2(
7923
+ authoringError(
7924
+ "pack-parameter-invalid",
7925
+ expected,
7926
+ "repair the v3 pack.json authoring data, then rerun scan or rebuild",
7927
+ {
7928
+ propertyPath,
7929
+ reason,
7930
+ actual: typeof actual === "string" ? actual : JSON.stringify(actual)
7931
+ }
7932
+ )
7933
+ );
7934
+ }
7935
+ function parsePackageId(value, propertyPath) {
7936
+ if (typeof value !== "string") {
7937
+ return failure2(
7938
+ authoringError(
7939
+ "pack-package-id-invalid",
7940
+ "a UUID string",
7941
+ "repair packageId in the authoring file",
7942
+ { propertyPath, value }
7943
+ )
7944
+ );
7945
+ }
7946
+ const parsed = PackageId.parse(value);
7947
+ if (!parsed.ok) {
7948
+ return failure2(
7949
+ authoringError(
7950
+ "pack-package-id-invalid",
7951
+ "a 36-character RFC 4122 UUID",
7952
+ "repair packageId or use the authoring gateway to mint one",
7953
+ { propertyPath, value },
7954
+ value
7955
+ )
7956
+ );
7957
+ }
7958
+ return ok(parsed.value);
7959
+ }
7960
+ function parsePackJsonAsset(value, sourceKey2) {
7961
+ if (!isRecord(value))
7962
+ return jsonError(
7963
+ `$.assets.${sourceKey2}`,
7964
+ "an asset entry object",
7965
+ value,
7966
+ "asset entry is not an object"
7967
+ );
7968
+ const allowed = /* @__PURE__ */ new Set(["kind", "payload", "refs", "name", "artifacts"]);
7969
+ const unknown = Object.keys(value).find((key) => !allowed.has(key));
7970
+ if (unknown !== void 0)
7971
+ return jsonError(
7972
+ `$.assets.${sourceKey2}.${unknown}`,
7973
+ "no GUID or extra authoring field",
7974
+ value[unknown],
7975
+ "direct v3 entries derive identity from their object key"
7976
+ );
7977
+ if (typeof value.kind !== "string" || value.kind.length === 0)
7978
+ return jsonError(
7979
+ `$.assets.${sourceKey2}.kind`,
7980
+ "a non-empty asset kind",
7981
+ value.kind,
7982
+ "asset kind is missing"
7983
+ );
7984
+ if (!isRecord(value.payload))
7985
+ return jsonError(
7986
+ `$.assets.${sourceKey2}.payload`,
7987
+ "a JSON object payload",
7988
+ value.payload,
7989
+ "payload must be a plain object"
7990
+ );
7991
+ if (!Array.isArray(value.refs) || value.refs.some((ref) => typeof ref !== "string" || !isValidAssetGuidString(ref))) {
7992
+ return jsonError(
7993
+ `$.assets.${sourceKey2}.refs`,
7994
+ "an array of UUID references",
7995
+ value.refs,
7996
+ "references must already be real AssetGuids"
7997
+ );
7998
+ }
7999
+ if (value.name !== void 0 && (typeof value.name !== "string" || value.name.length === 0))
8000
+ return jsonError(
8001
+ `$.assets.${sourceKey2}.name`,
8002
+ "a non-empty display name when present",
8003
+ value.name,
8004
+ "asset name is malformed"
8005
+ );
8006
+ if (value.artifacts !== void 0 && !isRecord(value.artifacts))
8007
+ return jsonError(
8008
+ `$.assets.${sourceKey2}.artifacts`,
8009
+ "an artifact descriptor object when present",
8010
+ value.artifacts,
8011
+ "artifacts are not an object"
8012
+ );
8013
+ const base = {
8014
+ kind: value.kind,
8015
+ payload: value.payload,
8016
+ refs: Object.freeze([...value.refs]),
8017
+ ...value.name === void 0 ? {} : { name: value.name }
8018
+ };
8019
+ if (value.artifacts === void 0) return ok(base);
8020
+ const withArtifacts = {
8021
+ ...base,
8022
+ artifacts: value.artifacts
8023
+ };
8024
+ return ok(withArtifacts);
8025
+ }
8026
+ function parseParameterizedPackJson(value) {
8027
+ if (!isRecord(value))
8028
+ return jsonError("$", "a v3 pack.json object", value, "document is not an object");
8029
+ if (value.schemaVersion !== "3.0.0")
8030
+ return jsonError(
8031
+ "$.schemaVersion",
8032
+ "the literal '3.0.0'",
8033
+ value.schemaVersion,
8034
+ "document schema is not v3"
8035
+ );
8036
+ const unknown = Object.keys(value).find(
8037
+ (key) => !["schemaVersion", "packageId", "assets", "parent", "values"].includes(key)
8038
+ );
8039
+ if (unknown !== void 0)
8040
+ return jsonError(
8041
+ `$.${unknown}`,
8042
+ "no extra top-level authoring fields",
8043
+ value[unknown],
8044
+ "keep the v3 document to packageId+assets or packageId+parent+values"
8045
+ );
8046
+ const packageResult = parsePackageId(value.packageId, "$.packageId");
8047
+ if (!packageResult.ok) return packageResult;
8048
+ const hasAssets = Object.hasOwn(value, "assets");
8049
+ const hasParent = Object.hasOwn(value, "parent");
8050
+ const hasValues = Object.hasOwn(value, "values");
8051
+ if (hasAssets && (hasParent || hasValues))
8052
+ return jsonError(
8053
+ "$",
8054
+ "assets or parent+values, never both",
8055
+ value,
8056
+ "direct and instance branches are mutually exclusive"
8057
+ );
8058
+ if (hasAssets) {
8059
+ if (!isRecord(value.assets))
8060
+ return jsonError(
8061
+ "$.assets",
8062
+ "a sourceKey to asset object",
8063
+ value.assets,
8064
+ "direct assets are not an object"
8065
+ );
8066
+ const assets = {};
8067
+ for (const [sourceKey2, entry] of Object.entries(value.assets)) {
8068
+ if (!isValidPackSourceKey(sourceKey2))
8069
+ return failure2(sourceKeyFailure(sourceKey2, `$.assets.${sourceKey2}`));
8070
+ const parsed = parsePackJsonAsset(entry, sourceKey2);
8071
+ if (!parsed.ok) return parsed;
8072
+ assets[sourceKey2] = parsed.value;
8073
+ }
8074
+ return ok({
8075
+ format: "direct",
8076
+ schemaVersion: "3.0.0",
8077
+ packageId: packageResult.value,
8078
+ assets: Object.freeze(assets)
8079
+ });
8080
+ }
8081
+ if (!hasParent || !hasValues || hasAssets)
8082
+ return jsonError(
8083
+ "$",
8084
+ "parent and values for an instance document",
8085
+ value,
8086
+ "instance branch is incomplete"
8087
+ );
8088
+ const parentResult = parsePackageId(value.parent, "$.parent");
8089
+ if (!parentResult.ok) return parentResult;
8090
+ if (!isRecord(value.values))
8091
+ return jsonError(
8092
+ "$.values",
8093
+ "a sparse parameter object",
8094
+ value.values,
8095
+ "instance values are not an object"
8096
+ );
8097
+ return ok({
8098
+ format: "instance",
8099
+ schemaVersion: "3.0.0",
8100
+ packageId: packageResult.value,
8101
+ parent: parentResult.value,
8102
+ values: Object.freeze({ ...value.values })
8103
+ });
8104
+ }
8105
+ var parsePackJson = parseParameterizedPackJson;
8106
+ var parsePackAuthoringJson = parseParameterizedPackJson;
8107
+ function projectDirectPackJson(value) {
8108
+ const parsed = "format" in value ? ok(value) : parseParameterizedPackJson(value);
8109
+ if (!parsed.ok) return parsed;
8110
+ if (parsed.value.format !== "direct") {
8111
+ return failure2(
8112
+ authoringError(
8113
+ "pack-parameter-invalid",
8114
+ "a direct v3 pack.json",
8115
+ "projectDirectPackJson accepts the direct branch only",
8116
+ { observed: parsed.value.format }
8117
+ )
8118
+ );
8119
+ }
8120
+ const assets = [];
8121
+ for (const [sourceKey2, entry] of Object.entries(parsed.value.assets).sort(
8122
+ ([left], [right]) => left.localeCompare(right)
8123
+ )) {
8124
+ assets.push({
8125
+ ...entry,
8126
+ guid: AssetGuid.format(AssetGuid.derive(parsed.value.packageId, sourceKey2)),
8127
+ sourceKey: sourceKey2
8128
+ });
8129
+ }
8130
+ return ok({ packageId: PackageId.format(parsed.value.packageId), assets: Object.freeze(assets) });
8131
+ }
8132
+ function subjectId(subject) {
8133
+ return PackageId.format(subject.packageId).toLowerCase();
8134
+ }
8135
+ async function resolvePackParameterInheritance(subject, readParent) {
8136
+ const visited = /* @__PURE__ */ new Set();
8137
+ async function visit(current, path) {
8138
+ const currentId = subjectId(current);
8139
+ if (visited.has(currentId) || path.includes(currentId)) {
8140
+ return failure2(
8141
+ authoringError(
8142
+ "pack-parent-cycle",
8143
+ "a finite acyclic Pack parent chain",
8144
+ "inspect parentChain and repair the first repeated packageId",
8145
+ { packageId: currentId, parentChain: [...path, currentId] }
8146
+ )
8147
+ );
8148
+ }
8149
+ visited.add(currentId);
8150
+ const nextPath = [...path, currentId];
8151
+ if (current.format === "direct") {
8152
+ return failure2(
8153
+ authoringError(
8154
+ "pack-parent-not-parameterized",
8155
+ "a parameterized Pack source as the parent",
8156
+ "direct packs cannot be instance parents; point the instance at a parameterized source",
8157
+ { packageId: currentId }
8158
+ )
8159
+ );
8160
+ }
8161
+ if (current.format === "source") {
8162
+ const descriptors2 = validateParameterDefinitions(current.parameters, "$.parameters");
8163
+ if (!descriptors2.ok) return descriptors2;
8164
+ if (descriptors2.value.length === 0) {
8165
+ return failure2(
8166
+ authoringError(
8167
+ "pack-parent-not-parameterized",
8168
+ "the parent source to declare a non-empty parameter list",
8169
+ "use clone for an independent zero-parameter Pack instead of creating an empty instance",
8170
+ { packageId: currentId }
8171
+ )
8172
+ );
8173
+ }
8174
+ const definition2 = {
8175
+ packageId: current.packageId,
8176
+ parameters: descriptors2.value};
8177
+ const values2 = resolvePackParameterValues(definition2);
8178
+ if (!values2.ok) return values2;
8179
+ return ok({
8180
+ packageId: current.packageId,
8181
+ rootPackageId: current.packageId,
8182
+ values: values2.value,
8183
+ parentChain: [],
8184
+ parameters: descriptors2.value
8185
+ });
8186
+ }
8187
+ const parent = await readParent(current.parent);
8188
+ if (parent === void 0) {
8189
+ return failure2(
8190
+ authoringError(
8191
+ "pack-parent-not-found",
8192
+ "the parent packageId to resolve in the source index",
8193
+ "inspect the parent locator or recreate the instance from a live parameterized Pack",
8194
+ { packageId: currentId, parent: PackageId.format(current.parent) }
8195
+ )
8196
+ );
8197
+ }
8198
+ if (PackageId.format(parent.packageId).toLowerCase() !== PackageId.format(current.parent).toLowerCase()) {
8199
+ return failure2(
8200
+ authoringError(
8201
+ "pack-parent-not-found",
8202
+ "the parent reader to return the requested packageId",
8203
+ "repair the Source Index locator and retry inheritance resolution",
8204
+ {
8205
+ packageId: currentId,
8206
+ requestedParent: PackageId.format(current.parent),
8207
+ observedParent: PackageId.format(parent.packageId)
8208
+ }
8209
+ )
8210
+ );
8211
+ }
8212
+ const resolvedParent = await visit(parent, nextPath);
8213
+ if (!resolvedParent.ok) return resolvedParent;
8214
+ const descriptors = resolvedParent.value.parameters;
8215
+ const definition = {
8216
+ packageId: resolvedParent.value.rootPackageId,
8217
+ parameters: descriptors};
8218
+ const values = resolvePackParameterValues(
8219
+ definition,
8220
+ current.values,
8221
+ resolvedParent.value.values
8222
+ );
8223
+ if (!values.ok) return values;
8224
+ return ok({
8225
+ packageId: current.packageId,
8226
+ rootPackageId: resolvedParent.value.rootPackageId,
8227
+ values: values.value,
8228
+ parentChain: [PackageId.format(current.parent), ...resolvedParent.value.parentChain],
8229
+ parameters: descriptors
8230
+ });
8231
+ }
8232
+ return visit(subject, []);
8233
+ }
8234
+ var resolvePackInheritance = resolvePackParameterInheritance;
8235
+ var PARAMETERIZED_PACK_OPERATION_IDS = [
8236
+ "asset.list",
8237
+ "asset.inspect",
8238
+ "asset.resolve",
8239
+ "asset.verify",
8240
+ "asset-source.create",
8241
+ "asset-source.clone",
8242
+ "asset-source.create-instance",
8243
+ "asset-source.apply-values",
8244
+ "asset-source.rebuild",
8245
+ "asset-source.cold-cook"
8246
+ ];
8247
+ function createParameterizedPackAuthoringGateway(port) {
8248
+ const requests = /* @__PURE__ */ new Map();
8249
+ return {
8250
+ execute(operation) {
8251
+ if (typeof operation.requestId !== "string" || operation.requestId.trim().length === 0) {
8252
+ return Promise.resolve(
8253
+ failure2(
8254
+ authoringError(
8255
+ "pack-source-revision-conflict",
8256
+ "a non-empty caller-minted requestId",
8257
+ "mint a new requestId and retry",
8258
+ { requestId: operation.requestId }
8259
+ )
8260
+ )
8261
+ );
8262
+ }
8263
+ let fingerprint;
8264
+ try {
8265
+ fingerprint = JSON.stringify(operation);
8266
+ } catch (cause) {
8267
+ return Promise.resolve(
8268
+ failure2(
8269
+ authoringError(
8270
+ "pack-parameter-invalid",
8271
+ "a JSON-serialisable authoring operation",
8272
+ "remove non-serialisable operation fields and retry with a new requestId",
8273
+ {
8274
+ requestId: operation.requestId,
8275
+ cause: cause instanceof Error ? cause.message : String(cause)
8276
+ }
8277
+ )
8278
+ )
8279
+ );
8280
+ }
8281
+ const previous = requests.get(operation.requestId);
8282
+ if (previous !== void 0) {
8283
+ if (previous.fingerprint === fingerprint) return previous.result;
8284
+ return Promise.resolve(
8285
+ failure2(
8286
+ authoringError(
8287
+ "pack-source-revision-conflict",
8288
+ "one immutable operation per requestId",
8289
+ "read the original result or mint a new requestId",
8290
+ { requestId: operation.requestId }
8291
+ )
8292
+ )
8293
+ );
8294
+ }
8295
+ const result = Promise.resolve().then(() => port.execute(operation)).catch(
8296
+ (cause) => failure2(
8297
+ authoringError(
8298
+ "pack-parameter-invalid",
8299
+ "the Pack authoring port to return a structured Result",
8300
+ "repair the gateway port failure, then retry with a new requestId",
8301
+ {
8302
+ requestId: operation.requestId,
8303
+ cause: cause instanceof Error ? cause.message : String(cause)
8304
+ }
8305
+ )
8306
+ )
8307
+ );
8308
+ requests.set(operation.requestId, { fingerprint, result });
8309
+ return result;
8310
+ }
8311
+ };
8312
+ }
8313
+ var PARAMETERIZED_PACK_OPERATION_DESCRIPTORS = PARAMETERIZED_PACK_OPERATION_IDS.map(
8314
+ (id) => ({
8315
+ id,
8316
+ domain: id.startsWith("asset-source.") ? "session" : "asset",
8317
+ readOnly: id.startsWith("asset."),
8318
+ requiresRevision: !id.startsWith("asset.") && id !== "asset-source.create"
8319
+ })
8320
+ );
8321
+ function isRecord2(value) {
7189
8322
  return typeof value === "object" && value !== null && !Array.isArray(value);
7190
8323
  }
7191
8324
  function hasText(value) {
7192
8325
  return typeof value === "string" && value.length > 0;
7193
8326
  }
7194
- function issue(code, subjectId, expected, hint, actual2, authority = "producer") {
7195
- const subject = { type: "asset", id: subjectId };
8327
+ function issue(code, subjectId2, expected, hint, actual, authority = "producer") {
8328
+ const subject = { type: "asset", id: subjectId2 };
7196
8329
  return {
7197
8330
  ok: false,
7198
8331
  error: {
7199
8332
  code,
7200
8333
  subject,
7201
8334
  expected,
7202
- ...actual2 === void 0 ? {} : { actual: actual2 },
8335
+ ...actual === void 0 ? {} : { actual },
7203
8336
  hint,
7204
8337
  authority
7205
8338
  }
7206
8339
  };
7207
8340
  }
7208
- function validateFacts(value, subjectId) {
8341
+ function validateFacts(value, subjectId2) {
7209
8342
  if ("packageId" in value && !hasText(value.packageId)) {
7210
8343
  return issue(
7211
8344
  "invalid-producer-fact",
7212
- subjectId,
8345
+ subjectId2,
7213
8346
  "packageId must be a non-empty string",
7214
8347
  "publish a stable package identity"
7215
8348
  );
7216
8349
  }
7217
8350
  if ("provenance" in value) {
7218
8351
  const provenance = value.provenance;
7219
- if (!isRecord(provenance) || !hasText(provenance.provider) || !hasText(provenance.version)) {
8352
+ if (!isRecord2(provenance) || !hasText(provenance.provider) || !hasText(provenance.version)) {
7220
8353
  return issue(
7221
8354
  "invalid-producer-fact",
7222
- subjectId,
8355
+ subjectId2,
7223
8356
  "provenance.provider and provenance.version must be non-empty",
7224
8357
  "publish provider identity and version"
7225
8358
  );
@@ -7227,10 +8360,10 @@ function validateFacts(value, subjectId) {
7227
8360
  }
7228
8361
  if ("revision" in value) {
7229
8362
  const revision = value.revision;
7230
- if (!isRecord(revision) || !hasText(revision.digest) || !hasText(revision.rootId) || typeof revision.observedAt !== "number" || !Number.isFinite(revision.observedAt)) {
8363
+ if (!isRecord2(revision) || !hasText(revision.digest) || !hasText(revision.rootId) || typeof revision.observedAt !== "number" || !Number.isFinite(revision.observedAt)) {
7231
8364
  return issue(
7232
8365
  "invalid-producer-fact",
7233
- subjectId,
8366
+ subjectId2,
7234
8367
  "revision.digest, revision.rootId and finite revision.observedAt",
7235
8368
  "publish a complete resource revision"
7236
8369
  );
@@ -7240,25 +8373,25 @@ function validateFacts(value, subjectId) {
7240
8373
  if (!Array.isArray(value.diagnostics)) {
7241
8374
  return issue(
7242
8375
  "invalid-producer-fact",
7243
- subjectId,
8376
+ subjectId2,
7244
8377
  "diagnostics must be an array",
7245
8378
  "publish structured diagnostics as an array"
7246
8379
  );
7247
8380
  }
7248
8381
  for (const diagnostic of value.diagnostics) {
7249
- if (!isRecord(diagnostic) || !hasText(diagnostic.code)) {
8382
+ if (!isRecord2(diagnostic) || !hasText(diagnostic.code)) {
7250
8383
  return issue(
7251
8384
  "invalid-producer-fact",
7252
- subjectId,
8385
+ subjectId2,
7253
8386
  "each diagnostic needs a stable code",
7254
8387
  "publish a machine-readable diagnostic code"
7255
8388
  );
7256
8389
  }
7257
8390
  if (diagnostic.severity === "blocking") {
7258
- if (!isRecord(diagnostic.subject) || !hasText(diagnostic.subject.id)) {
8391
+ if (!isRecord2(diagnostic.subject) || !hasText(diagnostic.subject.id)) {
7259
8392
  return issue(
7260
8393
  "invalid-producer-fact",
7261
- subjectId,
8394
+ subjectId2,
7262
8395
  "blocking diagnostic.subject must identify an object",
7263
8396
  "set subject.type and subject.id"
7264
8397
  );
@@ -7266,7 +8399,7 @@ function validateFacts(value, subjectId) {
7266
8399
  if (!hasText(diagnostic.expected) || !hasText(diagnostic.hint)) {
7267
8400
  return issue(
7268
8401
  "invalid-producer-fact",
7269
- subjectId,
8402
+ subjectId2,
7270
8403
  "blocking diagnostics need expected and hint",
7271
8404
  "provide an executable recovery hint"
7272
8405
  );
@@ -7276,16 +8409,16 @@ function validateFacts(value, subjectId) {
7276
8409
  }
7277
8410
  return { ok: true, value };
7278
8411
  }
7279
- function validateMetaSourceOverrides(value, subjectId) {
8412
+ function validateMetaSourceOverrides(value, subjectId2) {
7280
8413
  if (!("sourceOverrides" in value)) return { ok: true, value };
7281
8414
  const declaredSourceKeys = Array.isArray(value.subAssets) ? value.subAssets.flatMap(
7282
- (subAsset) => isRecord(subAsset) && hasText(subAsset.sourceKey) ? [subAsset.sourceKey] : []
8415
+ (subAsset) => isRecord2(subAsset) && hasText(subAsset.sourceKey) ? [subAsset.sourceKey] : []
7283
8416
  ) : [];
7284
8417
  const result = validateSourceOverrideMap(value.sourceOverrides, declaredSourceKeys);
7285
8418
  if (!result.ok) {
7286
8419
  return issue(
7287
8420
  result.error.code,
7288
- subjectId,
8421
+ subjectId2,
7289
8422
  result.error.expected,
7290
8423
  result.error.hint,
7291
8424
  result.error.actual,
@@ -7298,7 +8431,7 @@ function validateMetaSourceOverrides(value, subjectId) {
7298
8431
  };
7299
8432
  }
7300
8433
  function validateProducerContract(value) {
7301
- if (!isRecord(value)) {
8434
+ if (!isRecord2(value)) {
7302
8435
  return issue(
7303
8436
  "invalid-producer-fact",
7304
8437
  "unknown",
@@ -7306,15 +8439,15 @@ function validateProducerContract(value) {
7306
8439
  "publish a JSON object"
7307
8440
  );
7308
8441
  }
7309
- const subjectId = hasText(value.guid) ? value.guid : hasText(value.packageId) ? value.packageId : "unknown";
7310
- const facts = validateFacts(value, subjectId);
8442
+ const subjectId2 = hasText(value.guid) ? value.guid : hasText(value.packageId) ? value.packageId : "unknown";
8443
+ const facts = validateFacts(value, subjectId2);
7311
8444
  if (!facts.ok) return facts;
7312
- const metaOverrides = validateMetaSourceOverrides(value, subjectId);
8445
+ const metaOverrides = validateMetaSourceOverrides(value, subjectId2);
7313
8446
  if (!metaOverrides.ok) return metaOverrides;
7314
8447
  if ("kind" in value && !hasText(value.kind)) {
7315
8448
  return issue(
7316
8449
  "invalid-producer-fact",
7317
- subjectId,
8450
+ subjectId2,
7318
8451
  "kind must be a non-empty open string",
7319
8452
  "publish the provider-owned asset kind"
7320
8453
  );
@@ -7322,7 +8455,7 @@ function validateProducerContract(value) {
7322
8455
  if ("execution" in value && value.execution !== "direct" && value.execution !== "cooked") {
7323
8456
  return issue(
7324
8457
  "invalid-producer-fact",
7325
- subjectId,
8458
+ subjectId2,
7326
8459
  "execution must be either direct or cooked",
7327
8460
  "publish the explicit authoring execution mode"
7328
8461
  );
@@ -7332,7 +8465,7 @@ function validateProducerContract(value) {
7332
8465
  if (value.sourceKey !== void 0 && !hasText(value.sourceKey)) {
7333
8466
  return issue(
7334
8467
  "invalid-source-key",
7335
- subjectId,
8468
+ subjectId2,
7336
8469
  "sourceKey must be a non-empty producer-owned string",
7337
8470
  "publish a stable semantic sourceKey"
7338
8471
  );
@@ -7340,7 +8473,7 @@ function validateProducerContract(value) {
7340
8473
  if (value.sourceIndex !== void 0 && (typeof value.sourceIndex !== "number" || !Number.isInteger(value.sourceIndex) || value.sourceIndex < 0)) {
7341
8474
  return issue(
7342
8475
  "invalid-source-index",
7343
- subjectId,
8476
+ subjectId2,
7344
8477
  "sourceIndex must be a non-negative integer locator",
7345
8478
  "publish a non-negative sourceIndex without using it as identity"
7346
8479
  );
@@ -7348,7 +8481,7 @@ function validateProducerContract(value) {
7348
8481
  if (value.sourceKey === void 0 && value.sourceIndex !== void 0) {
7349
8482
  return issue(
7350
8483
  "missing-source-key",
7351
- subjectId,
8484
+ subjectId2,
7352
8485
  "sourceKey is required when an output declares sourceIndex",
7353
8486
  "publish a stable semantic key; do not derive identity from sourceIndex"
7354
8487
  );
@@ -7356,7 +8489,7 @@ function validateProducerContract(value) {
7356
8489
  if ("compatiblePreviousKinds" in value && (!Array.isArray(value.compatiblePreviousKinds) || value.compatiblePreviousKinds.some((kind) => !hasText(kind)))) {
7357
8490
  return issue(
7358
8491
  "invalid-producer-fact",
7359
- subjectId,
8492
+ subjectId2,
7360
8493
  "compatiblePreviousKinds must be an array of non-empty kind strings",
7361
8494
  "declare only producer-verified prior kinds that may preserve the GUID"
7362
8495
  );
@@ -7394,93 +8527,6 @@ function validateProducerOutputs(outputs) {
7394
8527
  return { ok: true, value: outputs };
7395
8528
  }
7396
8529
 
7397
- // src/errors.ts
7398
- var PackError = class extends Error {
7399
- code;
7400
- expected;
7401
- hint;
7402
- detail;
7403
- constructor(args) {
7404
- super(`[PackError ${args.code}] expected: ${args.expected}; hint: ${args.hint}`);
7405
- this.name = "PackError";
7406
- this.code = args.code;
7407
- this.expected = args.expected;
7408
- this.hint = args.hint;
7409
- this.detail = args.detail;
7410
- }
7411
- };
7412
-
7413
- // src/guid.ts
7414
- function brand(bytes) {
7415
- return bytes;
7416
- }
7417
- var HEX_BYTE = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
7418
- function bytesToDashForm(bytes) {
7419
- const h = HEX_BYTE;
7420
- 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]]}`;
7421
- }
7422
- var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7423
- function isValidAssetGuidString(value) {
7424
- return typeof value === "string" && UUID_RE.test(value);
7425
- }
7426
- function dashFormToBytes(dashForm) {
7427
- const hex = dashForm.replace(/-/g, "");
7428
- const bytes = new Uint8Array(16);
7429
- for (let i = 0; i < 16; i++) {
7430
- bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
7431
- }
7432
- return bytes;
7433
- }
7434
- var AssetGuid = {
7435
- /**
7436
- * Parse a 36-char RFC 4122 dash-form UUID string into an AssetGuid.
7437
- * Returns Ok(AssetGuid) on success or Err(PackError) with code 'pack-guid-malformed' on failure.
7438
- * Never throws for expected failures (requirements §4.2 / §14 / charter proposition 4).
7439
- */
7440
- parse(dashForm) {
7441
- if (!isValidAssetGuidString(dashForm)) {
7442
- return {
7443
- ok: false,
7444
- error: new PackError({
7445
- code: "pack-guid-malformed",
7446
- expected: "36-char RFC 4122 dash-form UUID",
7447
- hint: "use AssetGuid.random() or a UUIDv7 generator; all GUID fields must be 36-char RFC 4122 dash-form",
7448
- detail: {
7449
- raw: dashForm,
7450
- reason: "expected 36-char RFC 4122 dash-form UUID"
7451
- }
7452
- })
7453
- };
7454
- }
7455
- return { ok: true, value: brand(dashFormToBytes(dashForm)) };
7456
- },
7457
- /**
7458
- * Format an AssetGuid as a 36-char RFC 4122 lowercase dash-form string.
7459
- */
7460
- format(guid) {
7461
- return bytesToDashForm(guid);
7462
- },
7463
- /**
7464
- * Test byte-by-byte equality between two AssetGuids.
7465
- */
7466
- equals(a, b) {
7467
- for (let i = 0; i < 16; i++) {
7468
- if (a[i] !== b[i]) return false;
7469
- }
7470
- return true;
7471
- },
7472
- /**
7473
- * Mint a new time-ordered UUIDv7 as an AssetGuid.
7474
- * Works in both Node.js and browser environments.
7475
- */
7476
- random() {
7477
- const uuid = uuidv7obj();
7478
- const bytes = new Uint8Array(16);
7479
- bytes.set(uuid.bytes);
7480
- return brand(bytes);
7481
- }
7482
- };
7483
-
7484
8530
  // src/scriptable-pack.ts
7485
8531
  var SCRIPTABLE_PACK_ASSET_KINDS = [
7486
8532
  "mesh",
@@ -7498,15 +8544,17 @@ var SCRIPTABLE_PACK_ASSET_KINDS = [
7498
8544
  "animation-clip",
7499
8545
  "animation-graph",
7500
8546
  "audio",
7501
- "particle-effect"
8547
+ "particle-effect",
8548
+ "ies-profile"
7502
8549
  ];
7503
8550
  function isScriptablePackAssetKind(value) {
7504
8551
  return SCRIPTABLE_PACK_ASSET_KINDS.includes(value);
7505
8552
  }
7506
8553
  function sceneComponentFieldType(value) {
7507
8554
  if (typeof value === "string") return value;
7508
- if (isRecord2(value) && typeof value.type === "string") return value.type;
7509
- return void 0;
8555
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
8556
+ const type = value.type;
8557
+ return typeof type === "string" ? type : void 0;
7510
8558
  }
7511
8559
  function projectScriptablePackSceneComponents(components) {
7512
8560
  return (components ?? []).map((component) => ({
@@ -7519,430 +8567,6 @@ function projectScriptablePackSceneComponents(components) {
7519
8567
  )
7520
8568
  }));
7521
8569
  }
7522
- var SCRIPTABLE_PACK_REQUEST_ID_SCHEMA = {
7523
- type: "string",
7524
- minLength: 1,
7525
- maxLength: 128,
7526
- pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
7527
- description: "Caller-minted identity for one idempotent ScriptablePack operation."
7528
- };
7529
- var SCRIPTABLE_PACK_SOURCE_PATH_SCHEMA = {
7530
- type: "string",
7531
- minLength: 8,
7532
- pattern: "^[^/].*\\.pack\\.ts$",
7533
- description: "Game-root-relative ScriptablePack source path."
7534
- };
7535
- var SCRIPTABLE_PACK_OWNER_GUID_SCHEMA = {
7536
- type: "string",
7537
- format: "uuid",
7538
- description: "Catalog GUID used to resolve the producer-owned source subject."
7539
- };
7540
- var SCRIPTABLE_PACK_REVISION_SCHEMA = {
7541
- type: "string",
7542
- minLength: 64,
7543
- maxLength: 64,
7544
- pattern: "^[a-f0-9]{64}$",
7545
- description: "SHA-256 source revision returned by preflight."
7546
- };
7547
- var SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA = { type: "string", minLength: 1 };
7548
- var SCRIPTABLE_PACK_ASSET_KIND_SCHEMA = {
7549
- enum: SCRIPTABLE_PACK_ASSET_KINDS,
7550
- description: "Ordinary Asset kind supported by the ScriptablePack producer/loader matrix."
7551
- };
7552
- var SCRIPTABLE_PACK_NAME_SCHEMA = { type: "string", minLength: 1 };
7553
- function scriptablePackArgsSchema(properties, required, options = {}) {
7554
- const subjectRequired = ["requestId", ...required];
7555
- return {
7556
- type: "object",
7557
- properties: {
7558
- sourcePath: SCRIPTABLE_PACK_SOURCE_PATH_SCHEMA,
7559
- ownerGuid: SCRIPTABLE_PACK_OWNER_GUID_SCHEMA,
7560
- requestId: SCRIPTABLE_PACK_REQUEST_ID_SCHEMA,
7561
- ...properties
7562
- },
7563
- required: subjectRequired,
7564
- ...options.subject === false ? {} : {
7565
- anyOf: [
7566
- { required: [...subjectRequired, "sourcePath"] },
7567
- { required: [...subjectRequired, "ownerGuid"] },
7568
- ...options.guidSubject === false ? [] : [{ required: [...subjectRequired, "guid"] }]
7569
- ]
7570
- },
7571
- additionalProperties: false
7572
- };
7573
- }
7574
- [
7575
- {
7576
- id: "asset-source.create",
7577
- kind: "create",
7578
- domain: "session",
7579
- title: "Create Asset Source",
7580
- argsSchema: scriptablePackArgsSchema(
7581
- {
7582
- name: SCRIPTABLE_PACK_NAME_SCHEMA,
7583
- initialOutput: {
7584
- type: "object",
7585
- properties: {
7586
- sourceKey: SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA,
7587
- kind: SCRIPTABLE_PACK_ASSET_KIND_SCHEMA,
7588
- name: SCRIPTABLE_PACK_NAME_SCHEMA
7589
- },
7590
- required: ["sourceKey", "kind"],
7591
- additionalProperties: false
7592
- }
7593
- },
7594
- ["sourcePath", "initialOutput"],
7595
- { subject: false }
7596
- )
7597
- },
7598
- {
7599
- id: "asset-source.add-output",
7600
- kind: "add-output",
7601
- domain: "session",
7602
- title: "Add Asset Source Output",
7603
- argsSchema: scriptablePackArgsSchema(
7604
- {
7605
- sourceKey: SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA,
7606
- assetKind: SCRIPTABLE_PACK_ASSET_KIND_SCHEMA,
7607
- name: SCRIPTABLE_PACK_NAME_SCHEMA,
7608
- expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA
7609
- },
7610
- ["sourceKey", "assetKind", "expectedRevision"]
7611
- )
7612
- },
7613
- {
7614
- id: "asset-source.add-external-asset",
7615
- kind: "add-external-asset",
7616
- domain: "session",
7617
- title: "Add Asset Source External Asset",
7618
- argsSchema: scriptablePackArgsSchema(
7619
- {
7620
- alias: SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA,
7621
- guid: { type: "string", format: "uuid" },
7622
- expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA
7623
- },
7624
- ["alias", "guid", "expectedRevision"],
7625
- { guidSubject: false }
7626
- )
7627
- },
7628
- {
7629
- id: "asset-source.rename",
7630
- kind: "rename",
7631
- domain: "session",
7632
- title: "Rename Asset Source Display Name",
7633
- argsSchema: scriptablePackArgsSchema(
7634
- {
7635
- target: {
7636
- oneOf: [
7637
- {
7638
- type: "object",
7639
- properties: { kind: { const: "package" } },
7640
- required: ["kind"],
7641
- additionalProperties: false
7642
- },
7643
- {
7644
- type: "object",
7645
- properties: {
7646
- kind: { const: "output" },
7647
- sourceKey: SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA
7648
- },
7649
- required: ["kind", "sourceKey"],
7650
- additionalProperties: false
7651
- }
7652
- ]
7653
- },
7654
- name: SCRIPTABLE_PACK_NAME_SCHEMA,
7655
- expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA
7656
- },
7657
- ["target", "name", "expectedRevision"]
7658
- )
7659
- },
7660
- {
7661
- id: "asset-source.remove-output",
7662
- kind: "remove-output",
7663
- domain: "session",
7664
- title: "Remove Asset Source Output",
7665
- destructive: true,
7666
- argsSchema: scriptablePackArgsSchema(
7667
- {
7668
- sourceKey: SCRIPTABLE_PACK_SOURCE_KEY_SCHEMA,
7669
- confirmIncomingRefs: { type: "array", items: { type: "string" } },
7670
- expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA
7671
- },
7672
- ["sourceKey", "expectedRevision"]
7673
- )
7674
- },
7675
- {
7676
- id: "asset-source.clone",
7677
- kind: "clone",
7678
- domain: "session",
7679
- title: "Clone Asset Source",
7680
- argsSchema: scriptablePackArgsSchema(
7681
- {
7682
- targetPath: SCRIPTABLE_PACK_SOURCE_PATH_SCHEMA,
7683
- expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA
7684
- },
7685
- ["targetPath", "expectedRevision"]
7686
- )
7687
- },
7688
- {
7689
- id: "asset-source.rebuild",
7690
- kind: "rebuild",
7691
- domain: "session",
7692
- title: "Rebuild Asset Source",
7693
- argsSchema: scriptablePackArgsSchema({ expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA }, [
7694
- "expectedRevision"
7695
- ])
7696
- },
7697
- {
7698
- id: "asset-source.cold-cook",
7699
- kind: "cold-cook",
7700
- domain: "session",
7701
- title: "Cold Cook Asset Source",
7702
- argsSchema: scriptablePackArgsSchema({ expectedRevision: SCRIPTABLE_PACK_REVISION_SCHEMA }, [
7703
- "expectedRevision"
7704
- ])
7705
- }
7706
- ];
7707
- function actual(value) {
7708
- if (value === null) return "null";
7709
- if (Array.isArray(value)) return "array";
7710
- if (ArrayBuffer.isView(value)) return value.constructor.name;
7711
- return typeof value;
7712
- }
7713
- function invalid2(propertyPath, expected, value, sourcePath) {
7714
- return err({
7715
- code: "pack-source-definition-invalid",
7716
- expected,
7717
- hint: "repair the default exported ScriptablePack definition, then inspect Meta again",
7718
- detail: {
7719
- ...sourcePath === void 0 ? {} : { sourcePath },
7720
- propertyPath,
7721
- actual: actual(value)
7722
- }
7723
- });
7724
- }
7725
- function isRecord2(value) {
7726
- return value !== null && typeof value === "object" && !Array.isArray(value);
7727
- }
7728
- function isAssetGuid(value) {
7729
- return value instanceof Uint8Array && value.byteLength === 16;
7730
- }
7731
- function guidKey(guid) {
7732
- return AssetGuid.format(guid);
7733
- }
7734
- function freezeDefinition(definition) {
7735
- const assets = Object.fromEntries(
7736
- Object.entries(definition.assets).map(([sourceKey2, descriptor]) => [
7737
- sourceKey2,
7738
- Object.freeze({ ...descriptor, guid: descriptor.guid.slice() })
7739
- ])
7740
- );
7741
- const externalAssets = Object.fromEntries(
7742
- Object.entries(definition.externalAssets).map(([alias, guid]) => [
7743
- alias,
7744
- guid.slice()
7745
- ])
7746
- );
7747
- const sceneComponents = definition.sceneComponents === void 0 ? void 0 : Object.freeze(
7748
- projectScriptablePackSceneComponents(definition.sceneComponents).map(
7749
- (component) => Object.freeze({
7750
- ...component,
7751
- fields: Object.freeze({ ...component.fields })
7752
- })
7753
- )
7754
- );
7755
- return Object.freeze({
7756
- ...definition,
7757
- packageId: definition.packageId.slice(),
7758
- assets: Object.freeze(assets),
7759
- externalAssets: Object.freeze(externalAssets),
7760
- ...sceneComponents === void 0 ? {} : { sceneComponents }
7761
- });
7762
- }
7763
- function validateScriptablePackDefinition(value, sourcePath) {
7764
- if (!isRecord2(value))
7765
- return invalid2("$", "a ScriptablePack definition object", value, sourcePath);
7766
- if (value.schemaVersion !== "1.0.0") {
7767
- return invalid2("$.schemaVersion", "the literal '1.0.0'", value.schemaVersion, sourcePath);
7768
- }
7769
- if (!isAssetGuid(value.packageId)) {
7770
- return invalid2("$.packageId", "a 16-byte AssetGuid", value.packageId, sourcePath);
7771
- }
7772
- if (value.name !== void 0 && typeof value.name !== "string") {
7773
- return invalid2("$.name", "a string when present", value.name, sourcePath);
7774
- }
7775
- if (!isRecord2(value.assets) || Object.keys(value.assets).length === 0) {
7776
- return invalid2(
7777
- "$.assets",
7778
- "a non-empty sourceKey to descriptor object",
7779
- value.assets,
7780
- sourcePath
7781
- );
7782
- }
7783
- if (!isRecord2(value.externalAssets)) {
7784
- return invalid2(
7785
- "$.externalAssets",
7786
- "an alias to AssetGuid object",
7787
- value.externalAssets,
7788
- sourcePath
7789
- );
7790
- }
7791
- if (value.sceneComponents !== void 0) {
7792
- if (!Array.isArray(value.sceneComponents)) {
7793
- return invalid2(
7794
- "$.sceneComponents",
7795
- "an array of component tokens or neutral schema rows when present",
7796
- value.sceneComponents,
7797
- sourcePath
7798
- );
7799
- }
7800
- const componentNames = /* @__PURE__ */ new Set();
7801
- for (const [componentIndex, component] of value.sceneComponents.entries()) {
7802
- if (!isRecord2(component)) {
7803
- return invalid2(
7804
- `$.sceneComponents[${componentIndex}]`,
7805
- "a component token or neutral schema row",
7806
- component,
7807
- sourcePath
7808
- );
7809
- }
7810
- if (typeof component.name !== "string" || component.name.trim().length === 0) {
7811
- return invalid2(
7812
- `$.sceneComponents[${componentIndex}].name`,
7813
- "a non-empty component name",
7814
- component.name,
7815
- sourcePath
7816
- );
7817
- }
7818
- if (componentNames.has(component.name)) {
7819
- return invalid2(
7820
- `$.sceneComponents[${componentIndex}].name`,
7821
- "component names to be unique within one ScriptablePack",
7822
- component.name,
7823
- sourcePath
7824
- );
7825
- }
7826
- componentNames.add(component.name);
7827
- if (!isRecord2(component.fields)) {
7828
- return invalid2(
7829
- `$.sceneComponents[${componentIndex}].fields`,
7830
- "a field-name to schema-type object",
7831
- component.fields,
7832
- sourcePath
7833
- );
7834
- }
7835
- for (const [fieldName, field] of Object.entries(component.fields)) {
7836
- const type = sceneComponentFieldType(field);
7837
- if (fieldName.trim().length === 0 || type === void 0 || type.trim().length === 0) {
7838
- return invalid2(
7839
- `$.sceneComponents[${componentIndex}].fields`,
7840
- "field names with non-empty string schema types",
7841
- field,
7842
- sourcePath
7843
- );
7844
- }
7845
- }
7846
- }
7847
- }
7848
- if (typeof value.build !== "function") {
7849
- return invalid2("$.build", "a build(assetReader) function", value.build, sourcePath);
7850
- }
7851
- const packageGuid = guidKey(value.packageId);
7852
- const localGuids = /* @__PURE__ */ new Set();
7853
- for (const [sourceKey2, descriptor] of Object.entries(value.assets)) {
7854
- if (sourceKey2.trim().length === 0) {
7855
- return invalid2("$.assets", "non-empty sourceKey object keys", sourceKey2, sourcePath);
7856
- }
7857
- if (!isRecord2(descriptor)) {
7858
- return invalid2(
7859
- `$.assets[${JSON.stringify(sourceKey2)}]`,
7860
- "an asset descriptor",
7861
- descriptor,
7862
- sourcePath
7863
- );
7864
- }
7865
- if (!isAssetGuid(descriptor.guid)) {
7866
- return invalid2(
7867
- `$.assets[${JSON.stringify(sourceKey2)}].guid`,
7868
- "a 16-byte AssetGuid",
7869
- descriptor.guid,
7870
- sourcePath
7871
- );
7872
- }
7873
- if (typeof descriptor.kind !== "string" || !isScriptablePackAssetKind(descriptor.kind)) {
7874
- return invalid2(
7875
- `$.assets[${JSON.stringify(sourceKey2)}].kind`,
7876
- "one of SCRIPTABLE_PACK_ASSET_KINDS",
7877
- descriptor.kind,
7878
- sourcePath
7879
- );
7880
- }
7881
- if (descriptor.name !== void 0 && typeof descriptor.name !== "string") {
7882
- return invalid2(
7883
- `$.assets[${JSON.stringify(sourceKey2)}].name`,
7884
- "a string when present",
7885
- descriptor.name,
7886
- sourcePath
7887
- );
7888
- }
7889
- const guid = guidKey(descriptor.guid);
7890
- if (guid === packageGuid || localGuids.has(guid)) {
7891
- return invalid2(
7892
- `$.assets[${JSON.stringify(sourceKey2)}].guid`,
7893
- "a GUID unique within the package and distinct from packageId",
7894
- descriptor.guid,
7895
- sourcePath
7896
- );
7897
- }
7898
- localGuids.add(guid);
7899
- }
7900
- const externalGuids = /* @__PURE__ */ new Set();
7901
- for (const [alias, guidValue] of Object.entries(value.externalAssets)) {
7902
- if (alias.trim().length === 0) {
7903
- return invalid2("$.externalAssets", "non-empty alias object keys", alias, sourcePath);
7904
- }
7905
- if (!isAssetGuid(guidValue)) {
7906
- return invalid2(
7907
- `$.externalAssets[${JSON.stringify(alias)}]`,
7908
- "a 16-byte AssetGuid",
7909
- guidValue,
7910
- sourcePath
7911
- );
7912
- }
7913
- const guid = guidKey(guidValue);
7914
- if (guid === packageGuid || localGuids.has(guid) || externalGuids.has(guid)) {
7915
- return invalid2(
7916
- `$.externalAssets[${JSON.stringify(alias)}]`,
7917
- "a unique foreign GUID not owned by this package",
7918
- guidValue,
7919
- sourcePath
7920
- );
7921
- }
7922
- externalGuids.add(guid);
7923
- }
7924
- return ok(freezeDefinition(value));
7925
- }
7926
- function projectScriptablePackMeta(definition, source) {
7927
- const subAssets = Object.entries(definition.assets).sort(([left], [right]) => left.localeCompare(right)).map(([sourceKey2, descriptor], sourceIndex) => ({
7928
- guid: guidKey(descriptor.guid),
7929
- sourceIndex,
7930
- sourceKey: sourceKey2,
7931
- kind: descriptor.kind,
7932
- ...descriptor.name === void 0 ? {} : { name: descriptor.name }
7933
- }));
7934
- const externalAssets = Object.entries(definition.externalAssets).sort(([left], [right]) => left.localeCompare(right)).map(([alias, guid]) => ({ alias, guid: guidKey(guid) }));
7935
- return {
7936
- schemaVersion: "1.0.0",
7937
- kind: "external-asset-package",
7938
- packageId: guidKey(definition.packageId),
7939
- ...definition.name === void 0 ? {} : { name: definition.name },
7940
- importer: "pack-ts",
7941
- source,
7942
- importSettings: { contractVersion: "1.0.0", externalAssets },
7943
- subAssets
7944
- };
7945
- }
7946
8570
 
7947
8571
  // src/topology.ts
7948
8572
  function sourceKey(output) {
@@ -8153,7 +8777,7 @@ var meta_schema_default = {
8153
8777
  source: {
8154
8778
  type: "string",
8155
8779
  minLength: 1,
8156
- description: "Optional. Omit to derive the companion file in the same directory (strip .meta.json suffix from the meta filename). Or write @<name>/<rest> to reference a declared path table entry (see package.json#forgeax.assets.paths). Existing relative paths remain unchanged."
8780
+ description: "Optional. Omit to derive the companion file in the same directory (strip .meta.json suffix from the meta filename). An explicit source is resolved relative to this sidecar."
8157
8781
  },
8158
8782
  importSettings: {
8159
8783
  type: "object",
@@ -8294,11 +8918,11 @@ var pack_schema_default = {
8294
8918
  $comment: "The ordinary durable consumer matrix is SCRIPTABLE_PACK_ASSET_KINDS in @forgeax/engine-pack/source. Pack kind fields remain open for registered producer extensions.",
8295
8919
  type: "object",
8296
8920
  additionalProperties: false,
8297
- required: ["schemaVersion", "kind", "assets"],
8921
+ required: ["schemaVersion"],
8298
8922
  properties: {
8299
8923
  schemaVersion: {
8300
8924
  type: "string",
8301
- enum: ["1.0.0", "2.0.0"]
8925
+ enum: ["1.0.0", "2.0.0", "3.0.0"]
8302
8926
  },
8303
8927
  kind: {
8304
8928
  type: "string",
@@ -8320,12 +8944,58 @@ var pack_schema_default = {
8320
8944
  items: { $ref: "#/$defs/diagnostic" }
8321
8945
  },
8322
8946
  assets: {
8323
- type: "array",
8324
- items: {
8325
- $ref: "#/$defs/asset"
8326
- }
8947
+ oneOf: [
8948
+ {
8949
+ type: "array",
8950
+ items: { $ref: "#/$defs/asset" }
8951
+ },
8952
+ { $ref: "#/$defs/authoringAssets" }
8953
+ ]
8954
+ },
8955
+ parent: {
8956
+ $ref: "#/$defs/guid36",
8957
+ description: "Parent parameterized Pack packageId for one v3 instance."
8958
+ },
8959
+ values: {
8960
+ type: "object",
8961
+ additionalProperties: true,
8962
+ description: "Sparse shallow parameter overrides for one v3 instance."
8327
8963
  }
8328
8964
  },
8965
+ oneOf: [
8966
+ {
8967
+ required: ["kind", "assets"],
8968
+ properties: {
8969
+ schemaVersion: { enum: ["1.0.0", "2.0.0"] },
8970
+ kind: { const: "internal-text-package" },
8971
+ assets: { type: "array" },
8972
+ parent: false,
8973
+ values: false
8974
+ }
8975
+ },
8976
+ {
8977
+ required: ["packageId", "assets"],
8978
+ properties: {
8979
+ schemaVersion: { const: "3.0.0" },
8980
+ kind: false,
8981
+ packageId: { $ref: "#/$defs/guid36" },
8982
+ assets: { $ref: "#/$defs/authoringAssets" },
8983
+ parent: false,
8984
+ values: false
8985
+ }
8986
+ },
8987
+ {
8988
+ required: ["packageId", "parent", "values"],
8989
+ properties: {
8990
+ schemaVersion: { const: "3.0.0" },
8991
+ kind: false,
8992
+ packageId: { $ref: "#/$defs/guid36" },
8993
+ parent: { $ref: "#/$defs/guid36" },
8994
+ values: { type: "object" },
8995
+ assets: false
8996
+ }
8997
+ }
8998
+ ],
8329
8999
  allOf: [
8330
9000
  {
8331
9001
  if: {
@@ -8417,6 +9087,30 @@ var pack_schema_default = {
8417
9087
  }
8418
9088
  ]
8419
9089
  },
9090
+ authoringAssets: {
9091
+ type: "object",
9092
+ additionalProperties: false,
9093
+ patternProperties: {
9094
+ "^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*$": {
9095
+ $ref: "#/$defs/authoringAsset"
9096
+ }
9097
+ }
9098
+ },
9099
+ authoringAsset: {
9100
+ type: "object",
9101
+ additionalProperties: false,
9102
+ required: ["kind", "payload", "refs"],
9103
+ properties: {
9104
+ kind: { type: "string", minLength: 1 },
9105
+ name: { type: "string", minLength: 1 },
9106
+ payload: { type: "object" },
9107
+ refs: {
9108
+ type: "array",
9109
+ items: { $ref: "#/$defs/guid36" }
9110
+ },
9111
+ artifacts: { $ref: "#/$defs/artifacts" }
9112
+ }
9113
+ },
8420
9114
  artifacts: {
8421
9115
  type: "object",
8422
9116
  additionalProperties: false,
@@ -8546,7 +9240,7 @@ function writeMaterialArtifact(input) {
8546
9240
  digest: createMaterialArtifactDigest(input.bytes)
8547
9241
  };
8548
9242
  }
8549
- function invalid3(observed, expected) {
9243
+ function invalid2(observed, expected) {
8550
9244
  return err({
8551
9245
  code: "pack-v2-envelope-invalid",
8552
9246
  expected,
@@ -8565,10 +9259,10 @@ function isAsset(value) {
8565
9259
  }
8566
9260
  function projectRuntimePack(value) {
8567
9261
  if (!isRecord3(value) || ("schemaVersion" in value || "kind" in value) && (value.schemaVersion !== "2.0.0" || value.kind !== "internal-text-package")) {
8568
- return invalid3("legacy or malformed pack input", "runtime Pack v2");
9262
+ return invalid2("legacy or malformed pack input", "runtime Pack v2");
8569
9263
  }
8570
9264
  if (!isTuple(value) || !Array.isArray(value.assets) || !value.assets.every(isAsset)) {
8571
- return invalid3("incomplete publication tuple or asset envelope", "verified runtime Pack v2");
9265
+ return invalid2("incomplete publication tuple or asset envelope", "verified runtime Pack v2");
8572
9266
  }
8573
9267
  const seen = /* @__PURE__ */ new Set();
8574
9268
  for (const asset of value.assets) {
@@ -8607,6 +9301,6 @@ function parsePackV2(value) {
8607
9301
  return ok(value);
8608
9302
  }
8609
9303
 
8610
- export { MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, SCRIPTABLE_PACK_ASSET_KINDS, buildOfflineAssetEvidence, calculateTopologyDiff, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, decodeMeshBinHeader, diffTopology, isScriptablePackAssetKind, packageVerification, parsePackV2, projectCookedMaterialRecord, projectRuntimePack, projectScriptablePackMeta, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateArtifactPath, validateCookedMaterialRecord, validateMaterialCookReceipt, validateMeta, validatePack, validatePackV2, validateProducerContract, validateProducerOutputs, validateScriptablePackDefinition, writeMaterialArtifact, writeMeshBinHeader };
9304
+ export { AssetGuid, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, PACK_PARAMETER_TYPES, PACK_SOURCE_KEY_RE, PARAMETERIZED_PACK_OPERATION_DESCRIPTORS, PARAMETERIZED_PACK_OPERATION_IDS, PackageId, SCRIPTABLE_PACK_ASSET_KINDS, buildOfflineAssetEvidence, calculateTopologyDiff, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, createParameterizedPackAuthoringGateway, decodeMeshBinHeader, definePack, definePackageId, diffTopology, isParameterizedPack, isScriptablePackAssetKind, isValidAssetGuidString, isValidPackSourceKey, packageVerification, parsePackAuthoringJson, parsePackJson, parsePackV2, parseParameterizedPackJson, projectCookedMaterialRecord, projectDirectPackJson, projectParameterizedPackMeta, projectRuntimePack, projectScriptablePackSceneComponents, resolvePackInheritance, resolvePackParameterInheritance, resolvePackParameterValues, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateArtifactPath, validateCookedMaterialRecord, validateMaterialCookReceipt, validateMeta, validatePack, validatePackDefinition, validatePackV2, validateProducerContract, validateProducerOutputs, writeMaterialArtifact, writeMeshBinHeader };
8611
9305
  //# sourceMappingURL=index.mjs.map
8612
9306
  //# sourceMappingURL=index.mjs.map