@forgeax/engine-pack 0.1.32 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -148,7 +148,7 @@ lives in [`pack.schema.json`](schema/pack.schema.json) and
148
148
  [`meta.schema.json`](schema/meta.schema.json); this section is guidance, not a
149
149
  second manifest.
150
150
 
151
- The machine contract is [`asset-authority.schema.json`](../../asset-authority.schema.json). The audit gate is [`check-asset-authority-audit.mjs`](../../scripts/forgeax/check-asset-authority-audit.mjs); it reports subject, execution, author authority, runtime source, lifecycle, owner, producer, and sourceKey evidence for every named category.
151
+ The machine contract is [`schemas/asset-authority.schema.json`](../../schemas/asset-authority.schema.json). The audit gate is [`check-asset-authority-audit.mjs`](../../scripts/forgeax/check-asset-authority-audit.mjs); it reports subject, execution, author authority, runtime source, lifecycle, owner, producer, and sourceKey evidence for every named category.
152
152
 
153
153
  The staged route is explicit: `author-validation` -> `external-declaration` ->
154
154
  `import` -> `native-cook` -> `ddc-validation` -> `runtime-parse` ->
package/dist/build.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ok, err, catalogOperationsFor, authoringCapabilityForAssetKind, MATERIAL_TEXTURE_SLOTS, isMaterialProgramAbi, projectCookProductEvidence, projectAssetEvidence, validateSourceOverrideMap, PACK_ERROR_HINTS, catalogEntryDigest, deriveStandardLayerPlan, AssetError, ImportError } from '@forgeax/engine-types';
1
+ import { ok, err, catalogOperationsFor, authoringCapabilityForAssetKind, MATERIAL_TEXTURE_SLOTS, isMaterialSurfaceDeclaration, isMaterialProgramAbi, projectCookProductEvidence, projectAssetEvidence, validateSourceOverrideMap, PACK_ERROR_HINTS, catalogEntryDigest, deriveStandardLayerPlan, AssetError, ImportError } from '@forgeax/engine-types';
2
2
  import { dirname, resolve, isAbsolute, relative, join, basename, sep, extname } from 'path';
3
3
  import { sha1 } from '@noble/hashes/legacy.js';
4
4
  import { uuidv7obj } from 'uuidv7';
@@ -7129,8 +7129,8 @@ function vectorLength(type) {
7129
7129
  }
7130
7130
  function parameterValueError(parameter, value, propertyPath) {
7131
7131
  const { type } = parameter;
7132
- if (type === "bool" && typeof value !== "boolean") {
7133
- return parameterFailure(propertyPath, "a boolean", value, "bool value has the wrong type");
7132
+ if (type === "bool") {
7133
+ return typeof value === "boolean" ? void 0 : parameterFailure(propertyPath, "a boolean", value, "bool value has the wrong type");
7134
7134
  }
7135
7135
  if (numericType(type)) {
7136
7136
  if (typeof value !== "number" || !Number.isFinite(value)) {
@@ -7191,8 +7191,8 @@ function parameterValueError(parameter, value, propertyPath) {
7191
7191
  }
7192
7192
  return void 0;
7193
7193
  }
7194
- if (type === "string" && typeof value !== "string") {
7195
- return parameterFailure(propertyPath, "a string", value, "string parameter has the wrong type");
7194
+ if (type === "string") {
7195
+ return typeof value === "string" ? void 0 : parameterFailure(propertyPath, "a string", value, "string parameter has the wrong type");
7196
7196
  }
7197
7197
  if (type === "enum") {
7198
7198
  if (typeof value !== "string") {
@@ -10362,7 +10362,10 @@ function collectMaterialCookRefs(material) {
10362
10362
  return guid === void 0 ? [] : [guid];
10363
10363
  })
10364
10364
  ),
10365
- modules: unique((material.passes ?? []).map((pass) => pass.program.module))
10365
+ modules: unique([
10366
+ ...(material.passes ?? []).map((pass) => pass.program.module),
10367
+ ...material.surface === void 0 ? [] : [material.surface.module]
10368
+ ])
10366
10369
  };
10367
10370
  }
10368
10371
  function createMaterialArtifactDigest(bytes) {
@@ -10535,6 +10538,8 @@ function validateCookedMaterialRecord(value) {
10535
10538
  return invalid("resolved.parameters", resolved.parameters);
10536
10539
  if (resolved.values === null || typeof resolved.values !== "object" || Array.isArray(resolved.values))
10537
10540
  return invalid("resolved.values", resolved.values);
10541
+ if (resolved.surface !== void 0 && !isMaterialSurfaceDeclaration(resolved.surface))
10542
+ return invalid("resolved.surface", resolved.surface);
10538
10543
  const passes = resolved.passes;
10539
10544
  const passNames = /* @__PURE__ */ new Set();
10540
10545
  for (const [index, pass] of passes.entries()) {
@@ -11566,6 +11571,15 @@ async function inspectAsset(gameRoot, snapshot, operation) {
11566
11571
  const selected = subjectFor(gameRoot, snapshot, operation);
11567
11572
  if (!selected.ok) return selected;
11568
11573
  const subject = selected.value;
11574
+ const source = await readConfined({ gameRoot }, operation, subject.relativePath);
11575
+ if (!source.ok) return source;
11576
+ const inspectedSource = {
11577
+ ...sourceResult(subject, operation),
11578
+ revision: source.value.revision,
11579
+ ...subject.format === "source" ? {
11580
+ assets: snapshot.materialized.filter((asset) => asset.packageId === packageKey(subject.packageId)).map((asset) => ({ ...asset }))
11581
+ } : {}
11582
+ };
11569
11583
  if (operation.sourceKey !== void 0) {
11570
11584
  if (!isValidPackSourceKey(operation.sourceKey)) {
11571
11585
  return err(
@@ -11598,7 +11612,7 @@ async function inspectAsset(gameRoot, snapshot, operation) {
11598
11612
  (candidate) => candidate.packageId === packageKey(subject.packageId) && candidate.sourceKey === operation.sourceKey
11599
11613
  );
11600
11614
  return ok({
11601
- ...sourceResult(subject, operation),
11615
+ ...inspectedSource,
11602
11616
  sourceKey: asset.sourceKey,
11603
11617
  guid: asset.guid,
11604
11618
  kind: asset.kind,
@@ -11611,7 +11625,7 @@ async function inspectAsset(gameRoot, snapshot, operation) {
11611
11625
  (candidate) => candidate.packageId === packageKey(subject.packageId) && candidate.sourceKey === operation.sourceKey
11612
11626
  );
11613
11627
  return ok({
11614
- ...sourceResult(subject, operation),
11628
+ ...inspectedSource,
11615
11629
  sourceKey: operation.sourceKey,
11616
11630
  guid,
11617
11631
  ...materialized === void 0 ? { status: "identity" } : {
@@ -11635,7 +11649,7 @@ async function inspectAsset(gameRoot, snapshot, operation) {
11635
11649
  const resolved = await resolveInstance(snapshot, subject);
11636
11650
  if (!resolved.ok) return resolved;
11637
11651
  return ok({
11638
- ...sourceResult(subject, operation),
11652
+ ...inspectedSource,
11639
11653
  parameters: resolved.value.parameters.map((parameter) => ({
11640
11654
  name: parameter.name,
11641
11655
  type: parameter.type,
@@ -11649,7 +11663,7 @@ async function inspectAsset(gameRoot, snapshot, operation) {
11649
11663
  parentChain: resolved.value.parentChain
11650
11664
  });
11651
11665
  }
11652
- return ok(sourceResult(subject, operation));
11666
+ return ok(inspectedSource);
11653
11667
  }
11654
11668
  function listAssets(snapshot, operation) {
11655
11669
  const assets = snapshotAssets(snapshot).map((asset) => ({
@@ -12749,7 +12763,8 @@ async function executeRaw(options, operation) {
12749
12763
  refreshed.value.source,
12750
12764
  selected.value.packageId,
12751
12765
  {
12752
- format: refreshed.value.relative.endsWith(".pack.json") ? "pack.json" : "pack.ts"
12766
+ format: refreshed.value.relative.endsWith(".pack.json") ? "pack.json" : "pack.ts",
12767
+ assets: refreshedSnapshot.value.materialized.filter((asset) => asset.packageId === packageKey(selected.value.packageId)).map((asset) => ({ ...asset }))
12753
12768
  }
12754
12769
  );
12755
12770
  }