@forgeax/engine-pack 0.1.27 → 0.1.29

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 (52) hide show
  1. package/README.md +30 -17
  2. package/dist/build.mjs +35 -52
  3. package/dist/build.mjs.map +1 -1
  4. package/dist/cli-asset.d.ts +1 -1
  5. package/dist/cli-asset.d.ts.map +1 -1
  6. package/dist/cli-asset.mjs +40 -33
  7. package/dist/cli-asset.mjs.map +1 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/inventory/declaration.d.ts +1 -1
  11. package/dist/inventory/declaration.d.ts.map +1 -1
  12. package/dist/inventory/sync.d.ts.map +1 -1
  13. package/dist/native-cooker-registry.d.ts +1 -0
  14. package/dist/native-cooker-registry.d.ts.map +1 -1
  15. package/dist/native-cooker.mjs.map +1 -1
  16. package/dist/pack-authoring-node.mjs +22 -13
  17. package/dist/pack-authoring-node.mjs.map +1 -1
  18. package/dist/runtime.mjs +1 -1
  19. package/dist/runtime.mjs.map +1 -1
  20. package/dist/scanner.mjs +22 -13
  21. package/dist/scanner.mjs.map +1 -1
  22. package/dist/schema-compiled.d.ts.map +1 -1
  23. package/dist/schema.mjs +41 -63
  24. package/dist/schema.mjs.map +1 -1
  25. package/dist/scriptable-pack-node.d.ts.map +1 -1
  26. package/dist/scriptable-pack-node.mjs +11 -3
  27. package/dist/scriptable-pack-node.mjs.map +1 -1
  28. package/dist/scriptable-pack-worker.mjs +5 -1
  29. package/dist/scriptable-pack-worker.mjs.map +1 -1
  30. package/package.json +3 -6
  31. package/schema/meta.schema.json +1 -1
  32. package/src/__tests__/atlas-cli-region-mismatch.test.ts +1 -1
  33. package/src/__tests__/cli.unit.test.ts +1 -1
  34. package/src/__tests__/inventory-schema.test.ts +10 -10
  35. package/src/__tests__/pack-authoring.unit.test.ts +2 -4
  36. package/src/__tests__/pack.unit.test.ts +89 -127
  37. package/src/__tests__/scanner-instance-cycle.test.ts +92 -0
  38. package/src/__tests__/scanner-inventory.contract.test.ts +2 -2
  39. package/src/__tests__/scriptable-pack-diagnostic.integration.test.ts +45 -0
  40. package/src/atlas/run-atlas.ts +3 -3
  41. package/src/atlas/shelf-pack.ts +1 -1
  42. package/src/atlas/upng-ambient.d.ts +1 -1
  43. package/src/cli-asset.ts +22 -23
  44. package/src/inventory/binding.ts +3 -3
  45. package/src/inventory/declaration.ts +10 -48
  46. package/src/inventory/sync.ts +3 -2
  47. package/src/native-cooker-registry.ts +1 -0
  48. package/src/scanner.ts +29 -29
  49. package/src/schema-compiled.ts +40 -79
  50. package/src/scriptable-pack-node.ts +11 -3
  51. package/src/scriptable-pack-worker.ts +8 -1
  52. package/src/__tests__/scanner-mount-cycle.test.ts +0 -232
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ export { runAtlas } from './atlas/run-atlas.js';
2
3
  export interface PackEntry {
3
4
  readonly guid: string;
4
5
  readonly kind: string;
@@ -18,5 +19,4 @@ export declare function scanEntries(roots: readonly string[], ctx: AssetCtx): Pr
18
19
  ok: false;
19
20
  }>;
20
21
  export declare function runCliAsset(rest: string[], ctx: AssetCtx): Promise<number>;
21
- export {};
22
22
  //# sourceMappingURL=cli-asset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-asset.d.ts","sourceRoot":"","sources":["../src/cli-asset.ts"],"names":[],"mappings":";AAgCA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,QAAQ;IAChB,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KA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,CAgF3D;AAyBD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAiChF"}
@@ -7130,7 +7130,7 @@ async function runAtlas(rest, ctx) {
7130
7130
  if (!argsOutcome.ok) {
7131
7131
  return emitError(ctx, {
7132
7132
  code: "atlas-empty-input",
7133
- expected: "forgeax-engine-remote-asset atlas --input <glob> --name <prefix> [--output <dir>] [--max-atlas-size <n>]",
7133
+ expected: "forgeax asset atlas --input <glob> --name <prefix> [--output <dir>] [--max-atlas-size <n>]",
7134
7134
  hint: argsOutcome.message,
7135
7135
  detail: { receivedCount: 0 }
7136
7136
  });
@@ -8308,7 +8308,7 @@ var meta_schema_default = {
8308
8308
  properties: {
8309
8309
  schemaVersion: {
8310
8310
  oneOf: [{ type: "string" }, { type: "integer" }],
8311
- description: "Schema version. Strings (e.g. '1.0.0') for hand-authored .meta.json; integers (1, 2, ...) for importer-emitted .meta.json (forgeax-engine-remote-asset import writes schemaVersion: 1 as the wire format SSOT, GltfMetaJson literal type)."
8311
+ description: "Schema version. Strings (e.g. '1.0.0') for hand-authored .meta.json; integers (1, 2, ...) for importer-emitted .meta.json (forgeax asset import writes schemaVersion: 1 as the wire format SSOT, GltfMetaJson literal type)."
8312
8312
  },
8313
8313
  kind: {
8314
8314
  type: "string",
@@ -8919,9 +8919,17 @@ var WorkerScriptablePackExecutor = class {
8919
8919
  }
8920
8920
  };
8921
8921
  worker.on("message", onMessage);
8922
- worker.once("error", rejectLoad);
8922
+ const fail = (error) => {
8923
+ rejectLoad(error);
8924
+ const active = this.build;
8925
+ this.build = void 0;
8926
+ active?.reject(error);
8927
+ void this.dispose("failure");
8928
+ };
8929
+ worker.once("error", fail);
8923
8930
  worker.once("exit", (code) => {
8924
- if (code !== 0) rejectLoad(new Error(`ScriptablePack worker exited with code ${code}`));
8931
+ if (this.disposal !== void 0) return;
8932
+ fail(new Error(`ScriptablePack worker exited with code ${code}`));
8925
8933
  });
8926
8934
  });
8927
8935
  }
@@ -9150,16 +9158,17 @@ function makePackError(code, detail) {
9150
9158
  detail
9151
9159
  });
9152
9160
  }
9153
- function* extractMountSourceGuids(asset) {
9161
+ function* extractInstanceSourceGuids(asset) {
9154
9162
  if (asset.kind !== "scene") return;
9155
9163
  const payload = asset.payload;
9156
- if (!payload || !Array.isArray(payload.mounts)) return;
9157
- for (const rawMount of payload.mounts) {
9158
- const mount = rawMount;
9159
- const idx = mount.source;
9160
- if (typeof idx !== "number" || !Number.isInteger(idx)) continue;
9161
- if (idx < 0 || idx >= asset.refs.length) continue;
9162
- const resolved = asset.refs[idx];
9164
+ if (!payload || payload.entities === null || typeof payload.entities !== "object" || Array.isArray(payload.entities))
9165
+ return;
9166
+ for (const rawEntity of Object.values(payload.entities)) {
9167
+ if (rawEntity === null || typeof rawEntity !== "object" || Array.isArray(rawEntity)) continue;
9168
+ const instance = rawEntity.instance;
9169
+ if (instance === null || typeof instance !== "object" || Array.isArray(instance)) continue;
9170
+ const source = instance.source;
9171
+ const resolved = typeof source === "number" && Number.isInteger(source) ? asset.refs[source] : typeof source === "string" ? source : void 0;
9163
9172
  if (typeof resolved !== "string") continue;
9164
9173
  yield resolved.toLowerCase();
9165
9174
  }
@@ -9277,7 +9286,7 @@ async function scanValidated(roots, opts = {}, capture) {
9277
9286
  guidToPath.set(normalizedGuid, packPath);
9278
9287
  packRefs.set(normalizedGuid, [
9279
9288
  ...asset.refs.map((ref) => ref.toLowerCase()),
9280
- ...extractMountSourceGuids(asset)
9289
+ ...extractInstanceSourceGuids(asset)
9281
9290
  ]);
9282
9291
  }
9283
9292
  }
@@ -9381,7 +9390,7 @@ async function scanValidated(roots, opts = {}, capture) {
9381
9390
  guidToPath.set(normalizedGuid, packPath);
9382
9391
  packRefs.set(normalizedGuid, [
9383
9392
  ...asset.refs.map((ref) => ref.toLowerCase()),
9384
- ...extractMountSourceGuids(asset)
9393
+ ...extractInstanceSourceGuids(asset)
9385
9394
  ]);
9386
9395
  }
9387
9396
  capture?.declarations.set(packPath, {
@@ -9836,16 +9845,14 @@ async function scanEntries(roots, ctx) {
9836
9845
  }
9837
9846
  function helpBody() {
9838
9847
  return [
9839
- "forgeax-engine-remote-asset \u2014 offline pack scanner / lookup / verifier / atlas builder",
9848
+ "forgeax asset \u2014 offline pack scanner / lookup / verifier / atlas builder",
9840
9849
  "",
9841
9850
  "Usage:",
9842
- " forgeax-engine-remote-asset scan [--roots <dir>]",
9843
- " forgeax-engine-remote-asset lookup <guid>",
9844
- " forgeax-engine-remote-asset verify",
9845
- " forgeax-engine-remote-asset meta <source.pack.ts> --json",
9846
- " forgeax-engine-remote-asset lookup --guid <guid> --project <dir> --catalog <path> --json",
9847
- " forgeax-engine-remote-asset verify --guid <guid> --project <dir> --catalog <path> --json",
9848
- " forgeax-engine-remote-asset atlas --input <glob> --name <prefix> [--output <dir>] [--max-atlas-size <n>]",
9851
+ " forgeax asset list --root <project> --json",
9852
+ " forgeax asset inspect --subject <guid> --root <project> --json",
9853
+ " forgeax asset verify --root <project> --json",
9854
+ " forgeax asset inspect --subject <source.pack.ts> --root <project> --json",
9855
+ " forgeax asset atlas --input <glob> --name <prefix> --root <project> [--output <dir>]",
9849
9856
  "",
9850
9857
  "AI recovery commands (host execution remains explicit):",
9851
9858
  " inspect [--guid <guid>] read subject, execution, lifecycle, authority, and sourceKey evidence",
@@ -9887,7 +9894,7 @@ async function runCliAsset(rest, ctx) {
9887
9894
  return emitError2(ctx, {
9888
9895
  code: "unknown-subcommand",
9889
9896
  expected: "subcommand in {scan, lookup, verify, atlas, meta}",
9890
- hint: "run 'forgeax-engine-remote-asset --help' for usage",
9897
+ hint: "run 'forgeax help asset' for usage",
9891
9898
  detail: { subcommand: sub }
9892
9899
  });
9893
9900
  }
@@ -9908,7 +9915,7 @@ async function runMeta(rest, ctx) {
9908
9915
  } catch (error) {
9909
9916
  return emitError2(ctx, {
9910
9917
  code: "cli-parse-error",
9911
- expected: "forgeax-engine-remote-asset meta <source.pack.ts> --json",
9918
+ expected: "forgeax asset inspect --subject <source.pack.ts> --root <project> --json",
9912
9919
  hint: "pass one trusted ScriptablePack module path",
9913
9920
  detail: { message: error instanceof Error ? error.message : String(error) }
9914
9921
  });
@@ -9944,7 +9951,7 @@ async function runRecoveryCommand(operation, rest, ctx) {
9944
9951
  return emitError2(ctx, {
9945
9952
  code: "cli-parse-error",
9946
9953
  expected: `${operation} [--guid <guid>]`,
9947
- hint: "run 'forgeax-engine-remote-asset --help' for usage",
9954
+ hint: "run 'forgeax help asset' for usage",
9948
9955
  detail: { message: error instanceof Error ? error.message : String(error) }
9949
9956
  });
9950
9957
  }
@@ -9963,8 +9970,8 @@ async function runScan(rest, ctx) {
9963
9970
  const message = e instanceof Error ? e.message : String(e);
9964
9971
  return emitError2(ctx, {
9965
9972
  code: "cli-parse-error",
9966
- expected: "forgeax-engine-remote-asset scan [--roots <dir>]",
9967
- hint: "run 'forgeax-engine-remote-asset --help' for usage",
9973
+ expected: "forgeax asset list --root <project> --json",
9974
+ hint: "run 'forgeax help asset' for usage",
9968
9975
  detail: { message }
9969
9976
  });
9970
9977
  }
@@ -9979,7 +9986,7 @@ async function runLookup(rest, ctx) {
9979
9986
  if (typeof guid !== "string") {
9980
9987
  return emitError2(ctx, {
9981
9988
  code: "cli-parse-error",
9982
- expected: "forgeax-engine-remote-asset lookup <36-char-uuid>",
9989
+ expected: "forgeax asset inspect --subject <guid> --root <project> --json",
9983
9990
  hint: "pass a 36-char dash-form UUID positional argument"
9984
9991
  });
9985
9992
  }
@@ -10020,8 +10027,8 @@ async function runVerify(rest, ctx) {
10020
10027
  const message = e instanceof Error ? e.message : String(e);
10021
10028
  return emitError2(ctx, {
10022
10029
  code: "cli-parse-error",
10023
- expected: "forgeax-engine-remote-asset verify",
10024
- hint: "run 'forgeax-engine-remote-asset --help' for usage",
10030
+ expected: "forgeax asset verify --root <project> --json",
10031
+ hint: "run 'forgeax help asset' for usage",
10025
10032
  detail: { message }
10026
10033
  });
10027
10034
  }
@@ -10052,7 +10059,7 @@ function parseEvidenceOptions(rest, ctx) {
10052
10059
  emitError2(ctx, {
10053
10060
  code: "cli-parse-error",
10054
10061
  expected: "--guid <guid> --project <dir> --catalog <path> --json",
10055
- hint: "run 'forgeax-engine-remote-asset --help' for usage"
10062
+ hint: "run 'forgeax help asset' for usage"
10056
10063
  });
10057
10064
  return void 0;
10058
10065
  }
@@ -10062,7 +10069,7 @@ function parseEvidenceOptions(rest, ctx) {
10062
10069
  emitError2(ctx, {
10063
10070
  code: "cli-parse-error",
10064
10071
  expected: "--guid <guid> --project <dir> --catalog <path> --json",
10065
- hint: "run 'forgeax-engine-remote-asset --help' for usage",
10072
+ hint: "run 'forgeax help asset' for usage",
10066
10073
  detail: { message }
10067
10074
  });
10068
10075
  return void 0;
@@ -10208,6 +10215,6 @@ if (isBinEntry) {
10208
10215
  process.exit(exitCode);
10209
10216
  }
10210
10217
 
10211
- export { runCliAsset, scanEntries };
10218
+ export { runAtlas, runCliAsset, scanEntries };
10212
10219
  //# sourceMappingURL=cli-asset.mjs.map
10213
10220
  //# sourceMappingURL=cli-asset.mjs.map