@ifc-lite/cli 0.33.1 → 0.34.0

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 (49) hide show
  1. package/README.md +8 -1
  2. package/dist/commands/diff-content-io.d.ts +50 -0
  3. package/dist/commands/diff-content-io.d.ts.map +1 -0
  4. package/dist/commands/diff-content-io.js +104 -0
  5. package/dist/commands/diff-content-io.js.map +1 -0
  6. package/dist/commands/diff-content-report.d.ts +23 -0
  7. package/dist/commands/diff-content-report.d.ts.map +1 -0
  8. package/dist/commands/diff-content-report.js +67 -0
  9. package/dist/commands/diff-content-report.js.map +1 -0
  10. package/dist/commands/diff-content.d.ts +19 -0
  11. package/dist/commands/diff-content.d.ts.map +1 -1
  12. package/dist/commands/diff-content.js +120 -129
  13. package/dist/commands/diff-content.js.map +1 -1
  14. package/dist/commands/diff-engine.d.ts +32 -1
  15. package/dist/commands/diff-engine.d.ts.map +1 -1
  16. package/dist/commands/diff-engine.js +75 -15
  17. package/dist/commands/diff-engine.js.map +1 -1
  18. package/dist/commands/diff-geometry.d.ts +107 -0
  19. package/dist/commands/diff-geometry.d.ts.map +1 -0
  20. package/dist/commands/diff-geometry.js +262 -0
  21. package/dist/commands/diff-geometry.js.map +1 -0
  22. package/dist/commands/diff-lineage-io.d.ts +23 -0
  23. package/dist/commands/diff-lineage-io.d.ts.map +1 -0
  24. package/dist/commands/diff-lineage-io.js +119 -0
  25. package/dist/commands/diff-lineage-io.js.map +1 -0
  26. package/dist/commands/diff.d.ts.map +1 -1
  27. package/dist/commands/diff.js +34 -3
  28. package/dist/commands/diff.js.map +1 -1
  29. package/dist/commands/rekey.d.ts +27 -0
  30. package/dist/commands/rekey.d.ts.map +1 -0
  31. package/dist/commands/rekey.js +192 -0
  32. package/dist/commands/rekey.js.map +1 -0
  33. package/dist/commands/validate.d.ts.map +1 -1
  34. package/dist/commands/validate.js +2 -1
  35. package/dist/commands/validate.js.map +1 -1
  36. package/dist/headless-backend.d.ts.map +1 -1
  37. package/dist/headless-backend.js +31 -23
  38. package/dist/headless-backend.js.map +1 -1
  39. package/dist/index.js +10 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/query-overlay-relations.d.ts +8 -28
  42. package/dist/query-overlay-relations.d.ts.map +1 -1
  43. package/dist/query-overlay-relations.js +68 -78
  44. package/dist/query-overlay-relations.js.map +1 -1
  45. package/dist/query-overlay.d.ts +6 -2
  46. package/dist/query-overlay.d.ts.map +1 -1
  47. package/dist/query-overlay.js +61 -5
  48. package/dist/query-overlay.js.map +1 -1
  49. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"diff-content.js","sourceRoot":"","sources":["../../src/commands/diff-content.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,GAM5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAgB,MAAM,kBAAkB,CAAC;AAYxF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA2B;IAClE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEvC,gEAAgE;IAChE,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CA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C,OAAqD;IAErD,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC1C,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtE,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -19,5 +19,36 @@ export declare function modelIdentityOf(path: string, bytes: Uint8Array): ModelI
19
19
  * check is inert unless both sides supply them (see the "Hash collisions"
20
20
  * section of `docs/guide/model-diff.md`).
21
21
  */
22
- export declare function buildFileFingerprints(store: IfcDataStore): EntityFingerprint<DiffRef>[];
22
+ /** Adapter options shared by the CLI and MCP fingerprint builders (issue #4955). */
23
+ export interface FingerprintAdapterOptions {
24
+ /**
25
+ * An authored key to use as the cross-revision identity instead of GlobalId:
26
+ * `Tag`, or `<PsetName>.<PropertyName>`. An entity carrying a non-empty value
27
+ * is keyed `prop:<value>`; one without falls back to its GlobalId. Two
28
+ * entities sharing one authored value collapse under the diff's first-wins
29
+ * key index, so they are reported on `duplicateAuthoredKeys` and fall back
30
+ * to GlobalId too — a key that names two things is not a key.
31
+ */
32
+ keyProperty?: string;
33
+ /** Receives every authored value more than one entity carried. */
34
+ duplicateAuthoredKeys?: Map<string, number[]>;
35
+ }
36
+ /** Prefix on a fingerprint key taken from an authored property rather than a GlobalId. */
37
+ export declare const AUTHORED_KEY_PREFIX = "prop:";
38
+ /**
39
+ * Resolve every entity's key under an authored-key spec: `prop:<value>` where
40
+ * the value is present and unique, GlobalId otherwise. Duplicates are reported
41
+ * to the caller rather than silently collapsed by `indexByKey`.
42
+ */
43
+ export declare function resolveAuthoredKeys(store: IfcDataStore, entities: readonly {
44
+ expressId: number;
45
+ globalId: string;
46
+ }[], options: FingerprintAdapterOptions): Map<number, string>;
47
+ export declare function buildFileFingerprints(store: IfcDataStore, options?: FingerprintAdapterOptions): EntityFingerprint<DiffRef>[];
48
+ /** A collision discovered in either file invalidates that authored value in
49
+ * both files, including fingerprints already built for the first side. */
50
+ export declare function fallbackPairDuplicateAuthoredKeys(sides: readonly {
51
+ fingerprints: EntityFingerprint<DiffRef>[];
52
+ store: IfcDataStore;
53
+ }[], duplicates: ReadonlyMap<string, number[]>): void;
23
54
  //# sourceMappingURL=diff-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-engine.d.ts","sourceRoot":"","sources":["../../src/commands/diff-engine.ts"],"names":[],"mappings":"AA8BA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAWL,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAI1B,yEAAyE;AACzE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa,CAG9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAsBvF"}
1
+ {"version":3,"file":"diff-engine.d.ts","sourceRoot":"","sources":["../../src/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 'node:crypto';
29
29
  import { buildComponentFingerprints, buildDataFingerprint, } from '@ifc-lite/diff';
30
- import { RelationshipType } from '@ifc-lite/data';
31
- import { EntityExtractor, extractAllEntityAttributes, extractClassificationsOnDemand, extractProjectUnits, extractPropertiesOnDemand, extractQuantitiesOnDemand, getAttributeNamesAcrossSchemas, quantitySiScale, roundToScale, scaledPropertyValue, } from '@ifc-lite/parser';
30
+ import { RelationshipType, resolvedTypeName } from '@ifc-lite/data';
31
+ import { EntityExtractor, extractAllEntityAttributes, extractClassificationsOnDemand, extractProjectUnits, extractPropertiesOnDemand, extractQuantitiesOnDemand, authoredKeyValue, getAttributeNamesAcrossSchemas, parseAuthoredKeySpec, spatialContainerPath, quantitySiScale, roundToScale, scaledPropertyValue, } from '@ifc-lite/parser';
32
32
  import { classificationLabel } from './diff-classification-label.js';
33
33
  import { comparableEntities } from './diff-scope.js';
34
34
  /**
@@ -42,16 +42,46 @@ export function modelIdentityOf(path, bytes) {
42
42
  const digest = createHash('sha256').update(bytes).digest('hex');
43
43
  return { hash: `sha256:${digest}`, path };
44
44
  }
45
+ /** Prefix on a fingerprint key taken from an authored property rather than a GlobalId. */
46
+ export const AUTHORED_KEY_PREFIX = 'prop:';
45
47
  /**
46
- * Build one {@link EntityFingerprint} per `IfcObjectDefinition` in a store.
47
- *
48
- * `components` is populated as well as `dataHash`: the content pass's only
49
- * defence against a `dataHash` collision retiring an unrelated add/delete pair
50
- * is agreement on `ifcType` and on every component sub-hash, and the second
51
- * check is inert unless both sides supply them (see the "Hash collisions"
52
- * section of `docs/guide/model-diff.md`).
48
+ * Resolve every entity's key under an authored-key spec: `prop:<value>` where
49
+ * the value is present and unique, GlobalId otherwise. Duplicates are reported
50
+ * to the caller rather than silently collapsed by `indexByKey`.
53
51
  */
54
- export function buildFileFingerprints(store) {
52
+ export function resolveAuthoredKeys(store, entities, options) {
53
+ const keys = new Map();
54
+ const spec = options.keyProperty ? parseAuthoredKeySpec(options.keyProperty) : undefined;
55
+ if (!spec) {
56
+ for (const { expressId, globalId } of entities)
57
+ keys.set(expressId, globalId);
58
+ return keys;
59
+ }
60
+ const extractor = new EntityExtractor(store.source);
61
+ const owners = new Map();
62
+ for (const { expressId } of entities) {
63
+ const value = authoredKeyValue(store, expressId, spec, extractor);
64
+ if (value === undefined)
65
+ continue;
66
+ const list = owners.get(value);
67
+ if (list)
68
+ list.push(expressId);
69
+ else
70
+ owners.set(value, [expressId]);
71
+ }
72
+ for (const { expressId, globalId } of entities)
73
+ keys.set(expressId, globalId);
74
+ for (const [value, ids] of owners) {
75
+ if (ids.length === 1) {
76
+ keys.set(ids[0], `${AUTHORED_KEY_PREFIX}${value}`);
77
+ }
78
+ else {
79
+ options.duplicateAuthoredKeys?.set(value, ids);
80
+ }
81
+ }
82
+ return keys;
83
+ }
84
+ export function buildFileFingerprints(store, options = {}) {
55
85
  // Resolved once per store, not per entity: the same `IFCUNITASSIGNMENT` walk
56
86
  // every property in the file would otherwise repeat, and both `quantitySiScale`
57
87
  // and `scaleMeasureValue` are pure over it. An IfcQuantityLength/Area/Volume
@@ -61,19 +91,49 @@ export function buildFileFingerprints(store) {
61
91
  // physical quantity actually changed, reports every quantified/measured
62
92
  // entity as `modified` (see `buildDataInput`'s scaling comment).
63
93
  const units = extractProjectUnits(store.source, store.entityIndex);
94
+ const entities = [...comparableEntities(store)];
95
+ const keys = resolveAuthoredKeys(store, entities, options);
64
96
  const fingerprints = [];
65
- for (const { expressId, globalId, ifcType, source, isTypeObject } of comparableEntities(store)) {
97
+ for (const { expressId, globalId, ifcType, source, isTypeObject } of entities) {
66
98
  const input = buildDataInput(store, expressId, ifcType, source, isTypeObject, units);
67
- fingerprints.push({
68
- key: globalId,
99
+ const fingerprint = {
100
+ key: keys.get(expressId) ?? globalId,
69
101
  ifcType,
70
102
  dataHash: buildDataFingerprint(input),
71
103
  components: buildComponentFingerprints(input),
72
104
  ref: expressId,
73
- });
105
+ };
106
+ // Where the element sits, as a name path (issue #4955). Read for every
107
+ // entity even though only the successor stage consumes it: the adapter
108
+ // does not know which stages the caller will run.
109
+ const container = spatialContainerPath(store, expressId);
110
+ if (container !== undefined)
111
+ fingerprint.container = container;
112
+ fingerprints.push(fingerprint);
74
113
  }
75
114
  return fingerprints;
76
115
  }
116
+ /** A collision discovered in either file invalidates that authored value in
117
+ * both files, including fingerprints already built for the first side. */
118
+ export function fallbackPairDuplicateAuthoredKeys(sides, duplicates) {
119
+ if (duplicates.size === 0)
120
+ return;
121
+ for (const { fingerprints, store } of sides) {
122
+ const globalIds = new Map([...comparableEntities(store)].map((entity) => [entity.expressId, entity.globalId]));
123
+ for (const fingerprint of fingerprints) {
124
+ if (!fingerprint.key.startsWith(AUTHORED_KEY_PREFIX))
125
+ continue;
126
+ const value = fingerprint.key.slice(AUTHORED_KEY_PREFIX.length);
127
+ if (!duplicates.has(value))
128
+ continue;
129
+ const globalId = globalIds.get(fingerprint.ref);
130
+ if (!globalId) {
131
+ throw new Error(`Cannot restore GlobalId for authored-key collision on #${fingerprint.ref}`);
132
+ }
133
+ fingerprint.key = globalId;
134
+ }
135
+ }
136
+ }
77
137
  /**
78
138
  * Assemble the canonical {@link DataFingerprintInput} for one entity.
79
139
  *
@@ -125,7 +185,7 @@ units) {
125
185
  .map((typeId) => ({
126
186
  globalId: store.entities.getGlobalId(typeId) || undefined,
127
187
  name: store.entities.getName(typeId) || undefined,
128
- type: store.entities.getTypeName(typeId) || undefined,
188
+ type: resolvedTypeName(store.entities, typeId),
129
189
  }));
130
190
  // Resolved classification references (never entity references — see
131
191
  // `DataFingerprintInput.classifications`): an `IfcRelAssociatesClassification`
@@ -1 +1 @@
1
- {"version":3,"file":"diff-engine.js","sourceRoot":"","sources":["../../src/commands/diff-engine.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GAIrB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AAC;IAC7E,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;IACtF,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtF,CAAC"}
@@ -0,0 +1,107 @@
1
+ import type { DiffScope, EntityFingerprint } from '@ifc-lite/diff';
2
+ import type { IfcAPI as WasmIfcAPI } from '@ifc-lite/wasm';
3
+ import type { DiffRef } from './diff-engine.js';
4
+ /** Quantization grid for the geometry hash, in metres — the wasm default
5
+ * (`DEFAULT_GEOM_HASH_TOLERANCE` in `@ifc-lite/geometry`), restated here so
6
+ * this module has no runtime dependency on that package. */
7
+ export declare const GEOMETRY_HASH_TOLERANCE = 0.001;
8
+ /** Printed (CLI) or returned (adapters) when `--geometry` cannot run because
9
+ * the wasm runtime is not built on this host — the `.wasm` binary is
10
+ * gitignored and only present after a Rust-capable build. */
11
+ export declare const WASM_RUNTIME_ABSENT_MESSAGE: string;
12
+ export interface WasmRuntime {
13
+ api: WasmIfcAPI;
14
+ }
15
+ export type WasmRuntimeResult = {
16
+ ok: true;
17
+ runtime: WasmRuntime;
18
+ } | {
19
+ ok: false;
20
+ message: string;
21
+ };
22
+ /**
23
+ * Lazily load and initialize `@ifc-lite/wasm`, returning a ready `IfcAPI` with
24
+ * geometry hashing switched on.
25
+ *
26
+ * Never throws: a missing `.wasm` binary, a missing package resolution, or an
27
+ * init failure all come back as `{ ok: false, message }` so the caller can
28
+ * report a clear, actionable message instead of a raw stack trace. Not
29
+ * memoised — the caller owns the returned `IfcAPI` and must `.free()` it
30
+ * (issue #4956, AGENTS.md "Geometry & WASM").
31
+ */
32
+ export declare function loadWasmRuntime(): Promise<WasmRuntimeResult>;
33
+ export interface GeometryAabb {
34
+ readonly min: readonly [number, number, number];
35
+ readonly max: readonly [number, number, number];
36
+ }
37
+ /** Per-entity world geometry hashes, boxes and volumes from one wasm mesh
38
+ * pass, keyed by express id. */
39
+ export interface GeometryPassResult {
40
+ hashes: Map<DiffRef, bigint>;
41
+ aabbs: Map<DiffRef, GeometryAabb>;
42
+ volumes: Map<DiffRef, number>;
43
+ unitScale: number;
44
+ }
45
+ /**
46
+ * Run the wasm geometry pass over one file's bytes and collect per-entity
47
+ * world hashes, boxes and volumes (issue #4956).
48
+ *
49
+ * Ported from `scripts/xmatch/fingerprints.mjs`'s `geometryPass` — see that
50
+ * file's history for why each guard exists: a box with a non-finite
51
+ * coordinate is dropped rather than passed on (a present box must be usable,
52
+ * never a NaN the engine would classify as garbage), and a volume is kept
53
+ * only when finite and positive (`NaN` is the wasm's "not proved closed"
54
+ * sentinel).
55
+ *
56
+ * **Chunked, not one `processGeometryBatch` call over every job.** The naive
57
+ * one-shot version materializes every mesh of the whole file into a single
58
+ * `MeshCollection` before any hash is read, which OOMs on a large model
59
+ * (issue #4956 review) — the same reason the browser worker path never does
60
+ * this either (`@ifc-lite/geometry`'s `processStreamingBytes`, `batch-sizing.ts`).
61
+ * Each `JOBS_PER_BATCH`-sized slice gets its own `MeshCollection`, is read and
62
+ * freed, and only its extracted (hash, aabb, volume) triples survive into the
63
+ * next iteration.
64
+ *
65
+ * The pre-pass call is inside the same `try` the cache-clear `finally`
66
+ * guards: `buildPrePassOnce` can itself throw (a malformed file), and a throw
67
+ * before the `try` would skip `clearPrePassCache()`, carrying whatever partial
68
+ * state it left behind into the next file processed through this `api`.
69
+ *
70
+ * **Installs the source once, rather than passing `bytes` to every chunk's
71
+ * `processGeometryBatch` call.** The legacy call takes `data` positionally and
72
+ * copies it into wasm linear memory on every invocation — fine for one call,
73
+ * but `JOBS_PER_BATCH`-chunking turns that into hundreds of copies of the
74
+ * whole file for a large model (issue #4956 review). `setSourceBytes` +
75
+ * `processGeometryBatchFromSource` is the same lever the browser worker's
76
+ * cold-load path uses (`geometry.worker.ts`'s `applySourceBytesToApi` /
77
+ * `batchFromSourceFn`): install the file ONCE, then every chunk reads it off
78
+ * the wasm heap. Feature-detected — a wasm build that predates the `*FromSource`
79
+ * pair falls back to the legacy per-call `bytes` argument.
80
+ */
81
+ export declare function runGeometryPass(api: WasmIfcAPI, bytes: Uint8Array): GeometryPassResult;
82
+ /**
83
+ * Attach one file's geometry pass onto the fingerprints already built for it
84
+ * (mutates in place — the fingerprints are freshly built per file, never
85
+ * shared, so this is not a hazard).
86
+ */
87
+ export declare function attachGeometryFingerprints(fingerprints: readonly EntityFingerprint<DiffRef>[], geometry: GeometryPassResult): void;
88
+ /**
89
+ * The whole `--geometry` opt-in, as one call for `diff-content.ts`: lazily
90
+ * load the runtime, run the pass over both files, attach it to both sets of
91
+ * fingerprints, and report the resulting {@link DiffScope}. A missing runtime
92
+ * is reported through `warn` (a stderr line, not a thrown error) and the
93
+ * scope falls back to `'data'` — the rest of `--by-content` works fine
94
+ * without geometry, exactly as it always has.
95
+ *
96
+ * Frees the `IfcAPI` handle in `finally`, even if a pass throws (AGENTS.md
97
+ * "Geometry & WASM"). A pass that throws — a malformed or truncated model,
98
+ * or an internal wasm panic surfaced as a JS error — degrades to `'data'`
99
+ * scope with a warning rather than aborting the whole `--by-content` command
100
+ * (issue #4956 review): `--geometry` is opt-in extra evidence, and the
101
+ * data-only comparison underneath it is still a useful answer. Any
102
+ * `geometryHash`/`aabb`/`volume` a partial pass DID manage to attach before
103
+ * throwing is harmless left attached — `scope: 'data'` takes geometry out of
104
+ * the comparison regardless of what individual fingerprints carry.
105
+ */
106
+ export declare function resolveGeometryScope(enabled: boolean, baseBytes: Uint8Array, headBytes: Uint8Array, baseFingerprints: readonly EntityFingerprint<DiffRef>[], headFingerprints: readonly EntityFingerprint<DiffRef>[], warn: (message: string) => void): Promise<DiffScope>;
107
+ //# sourceMappingURL=diff-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-geometry.d.ts","sourceRoot":"","sources":["../../src/commands/diff-geometry.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;6DAE6D;AAC7D,eAAO,MAAM,uBAAuB,QAAO,CAAC;AAE5C;;8DAE8D;AAC9D,eAAO,MAAM,2BAA2B,QAGsC,CAAC;AAE/E,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GAClC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC;;;;;;;;;GASG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAmClE;AAuBD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACjD;AAED;iCACiC;AACjC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,kBAAkB,CAuGtF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,EACnD,QAAQ,EAAE,kBAAkB,GAC3B,IAAI,CASN;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,EACvD,gBAAgB,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,EACvD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,OAAO,CAAC,SAAS,CAAC,CAiBpB"}
@@ -0,0 +1,262 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * The `--geometry` half of `ifc-lite diff --by-content` (issue #4956).
6
+ *
7
+ * `diff-engine.ts` builds DATA-scope fingerprints only — the Node CLI has no
8
+ * geometry pipeline of its own, so every geometry-backed tier of
9
+ * `@ifc-lite/diff` (`renamed` on world geometry hash, `moved`/`reshaped`,
10
+ * split/merge, successors) abstains under `scope: 'data'`. This module is the
11
+ * missing pipeline: it loads `@ifc-lite/wasm` LAZILY (only when `--geometry` is
12
+ * passed — most invocations of this command never touch wasm at all), runs the
13
+ * same mesh pass the viewer's compare uses (`setComputeGeometryHashes` +
14
+ * `buildPrePassOnce` + `processGeometryBatch`), and attaches `geometryHash`,
15
+ * `aabb` and `volume` to fingerprints the caller already built.
16
+ *
17
+ * `scripts/xmatch/fingerprints.mjs` imports this module's compiled output
18
+ * rather than re-implementing the pass — see that file's header.
19
+ */
20
+ import { createRequire } from 'node:module';
21
+ import { readFile } from 'node:fs/promises';
22
+ /** Quantization grid for the geometry hash, in metres — the wasm default
23
+ * (`DEFAULT_GEOM_HASH_TOLERANCE` in `@ifc-lite/geometry`), restated here so
24
+ * this module has no runtime dependency on that package. */
25
+ export const GEOMETRY_HASH_TOLERANCE = 1e-3;
26
+ /** Printed (CLI) or returned (adapters) when `--geometry` cannot run because
27
+ * the wasm runtime is not built on this host — the `.wasm` binary is
28
+ * gitignored and only present after a Rust-capable build. */
29
+ export const WASM_RUNTIME_ABSENT_MESSAGE = '--geometry requires the @ifc-lite/wasm runtime, which is not built on this host ' +
30
+ '(packages/wasm/pkg/ifc-lite_bg.wasm is missing). Run `pnpm build:wasm:fetch` to fetch ' +
31
+ 'a prebuilt binary, or `pnpm build:wasm` with the Rust toolchain installed.';
32
+ /**
33
+ * Lazily load and initialize `@ifc-lite/wasm`, returning a ready `IfcAPI` with
34
+ * geometry hashing switched on.
35
+ *
36
+ * Never throws: a missing `.wasm` binary, a missing package resolution, or an
37
+ * init failure all come back as `{ ok: false, message }` so the caller can
38
+ * report a clear, actionable message instead of a raw stack trace. Not
39
+ * memoised — the caller owns the returned `IfcAPI` and must `.free()` it
40
+ * (issue #4956, AGENTS.md "Geometry & WASM").
41
+ */
42
+ export async function loadWasmRuntime() {
43
+ let wasmPath;
44
+ try {
45
+ wasmPath = createRequire(import.meta.url).resolve('@ifc-lite/wasm/ifc-lite_bg.wasm');
46
+ }
47
+ catch {
48
+ return { ok: false, message: WASM_RUNTIME_ABSENT_MESSAGE };
49
+ }
50
+ let bytes;
51
+ try {
52
+ bytes = await readFile(wasmPath);
53
+ }
54
+ catch {
55
+ return { ok: false, message: WASM_RUNTIME_ABSENT_MESSAGE };
56
+ }
57
+ try {
58
+ const wasmModule = await import('@ifc-lite/wasm');
59
+ wasmModule.initSync({ module: bytes });
60
+ // Constructed before the next call that can throw, so a failure past this
61
+ // point has a handle to free rather than leaking it (AGENTS.md "Geometry
62
+ // & WASM").
63
+ const api = new wasmModule.IfcAPI();
64
+ try {
65
+ api.setComputeGeometryHashes(GEOMETRY_HASH_TOLERANCE);
66
+ }
67
+ catch (error) {
68
+ api.free();
69
+ throw error;
70
+ }
71
+ return { ok: true, runtime: { api } };
72
+ }
73
+ catch (error) {
74
+ return {
75
+ ok: false,
76
+ message: `${WASM_RUNTIME_ABSENT_MESSAGE} (init failed: ${error.message})`,
77
+ };
78
+ }
79
+ }
80
+ /**
81
+ * Number of jobs sent to one `processGeometryBatch` call.
82
+ *
83
+ * Matches `DEFAULT_BATCH_SIZING.maxJobs` in `@ifc-lite/geometry`'s
84
+ * `batch-sizing.ts` — the cap the browser worker's adaptive sizer clamps every
85
+ * call to, tuned on the largest real models so one call's meshes stay a
86
+ * bounded slice of the file rather than the whole thing. Restated here
87
+ * (rather than imported) because that module is internal to the geometry
88
+ * worker's streaming path and not part of `@ifc-lite/geometry`'s public
89
+ * surface; kept in sync by citing the source. This path has no adaptive
90
+ * timing to resize it (a one-shot CLI pass, not a watchdog-bounded worker), so
91
+ * it is a fixed cap rather than the worker's targetMs-driven adaptive size.
92
+ */
93
+ const JOBS_PER_BATCH = 512;
94
+ /** Uint32 slots per job in `PrePassResult.jobs` — see `prePass.jobs.slice(startJob
95
+ * * JOB_STRIDE, endJob * JOB_STRIDE)` in `@ifc-lite/geometry`'s `processStreamingBytes`. */
96
+ const JOB_STRIDE = 3;
97
+ /**
98
+ * Run the wasm geometry pass over one file's bytes and collect per-entity
99
+ * world hashes, boxes and volumes (issue #4956).
100
+ *
101
+ * Ported from `scripts/xmatch/fingerprints.mjs`'s `geometryPass` — see that
102
+ * file's history for why each guard exists: a box with a non-finite
103
+ * coordinate is dropped rather than passed on (a present box must be usable,
104
+ * never a NaN the engine would classify as garbage), and a volume is kept
105
+ * only when finite and positive (`NaN` is the wasm's "not proved closed"
106
+ * sentinel).
107
+ *
108
+ * **Chunked, not one `processGeometryBatch` call over every job.** The naive
109
+ * one-shot version materializes every mesh of the whole file into a single
110
+ * `MeshCollection` before any hash is read, which OOMs on a large model
111
+ * (issue #4956 review) — the same reason the browser worker path never does
112
+ * this either (`@ifc-lite/geometry`'s `processStreamingBytes`, `batch-sizing.ts`).
113
+ * Each `JOBS_PER_BATCH`-sized slice gets its own `MeshCollection`, is read and
114
+ * freed, and only its extracted (hash, aabb, volume) triples survive into the
115
+ * next iteration.
116
+ *
117
+ * The pre-pass call is inside the same `try` the cache-clear `finally`
118
+ * guards: `buildPrePassOnce` can itself throw (a malformed file), and a throw
119
+ * before the `try` would skip `clearPrePassCache()`, carrying whatever partial
120
+ * state it left behind into the next file processed through this `api`.
121
+ *
122
+ * **Installs the source once, rather than passing `bytes` to every chunk's
123
+ * `processGeometryBatch` call.** The legacy call takes `data` positionally and
124
+ * copies it into wasm linear memory on every invocation — fine for one call,
125
+ * but `JOBS_PER_BATCH`-chunking turns that into hundreds of copies of the
126
+ * whole file for a large model (issue #4956 review). `setSourceBytes` +
127
+ * `processGeometryBatchFromSource` is the same lever the browser worker's
128
+ * cold-load path uses (`geometry.worker.ts`'s `applySourceBytesToApi` /
129
+ * `batchFromSourceFn`): install the file ONCE, then every chunk reads it off
130
+ * the wasm heap. Feature-detected — a wasm build that predates the `*FromSource`
131
+ * pair falls back to the legacy per-call `bytes` argument.
132
+ */
133
+ export function runGeometryPass(api, bytes) {
134
+ const hashes = new Map();
135
+ const aabbs = new Map();
136
+ const volumes = new Map();
137
+ let unitScale = 1;
138
+ const useSource = typeof api.setSourceBytes === 'function' &&
139
+ typeof api.processGeometryBatchFromSource === 'function';
140
+ if (useSource)
141
+ api.setSourceBytes(bytes);
142
+ try {
143
+ const pre = api.buildPrePassOnce(bytes);
144
+ unitScale = pre?.unitScale ?? 1;
145
+ const total = pre?.totalJobs ?? 0;
146
+ if (!pre || !pre.jobs || total === 0)
147
+ return { hashes, aabbs, volumes, unitScale };
148
+ const rtcOffset = pre.rtcOffset ? Array.from(pre.rtcOffset) : [0, 0, 0];
149
+ const [rtcX, rtcY, rtcZ] = rtcOffset;
150
+ const voidKeys = pre.voidKeys ?? new Uint32Array(0);
151
+ const voidCounts = pre.voidCounts ?? new Uint32Array(0);
152
+ const voidValues = pre.voidValues ?? new Uint32Array(0);
153
+ const styleIds = pre.styleIds ?? new Uint32Array(0);
154
+ const styleColors = pre.styleColors ?? new Uint8Array(0);
155
+ for (let startJob = 0; startJob < total; startJob += JOBS_PER_BATCH) {
156
+ const endJob = Math.min(startJob + JOBS_PER_BATCH, total);
157
+ const jobSlice = pre.jobs.slice(startJob * JOB_STRIDE, endJob * JOB_STRIDE);
158
+ const collection = useSource
159
+ ? api.processGeometryBatchFromSource(jobSlice, pre.unitScale ?? 1, rtcX, rtcY, rtcZ, pre.needsShift ?? false, voidKeys, voidCounts, voidValues, styleIds, styleColors, pre.planeAngleToRadians, pre.materialElementIds, pre.materialColorCounts, pre.materialColors)
160
+ : api.processGeometryBatch(bytes, jobSlice, pre.unitScale ?? 1, rtcX, rtcY, rtcZ, pre.needsShift ?? false, voidKeys, voidCounts, voidValues, styleIds, styleColors, pre.planeAngleToRadians, pre.materialElementIds, pre.materialColorCounts, pre.materialColors);
161
+ try {
162
+ const ids = collection.geometryHashIds;
163
+ const values = collection.geometryHashValues;
164
+ const boxes = collection.geometryAabbValues;
165
+ // Optional getter (issue #4955): a wasm build that predates it
166
+ // answers `undefined`, and volumes simply stay empty rather than
167
+ // throwing.
168
+ const volumeValues = collection.geometryVolumeValues;
169
+ for (let i = 0; i < ids.length; i++) {
170
+ hashes.set(ids[i], values[i]);
171
+ const volume = volumeValues?.[i];
172
+ if (volume !== undefined && Number.isFinite(volume) && volume > 0) {
173
+ volumes.set(ids[i], volume);
174
+ }
175
+ // Same optional-getter rule as volumes: no boxes, keep the hashes.
176
+ const box = boxes ? Array.from(boxes.slice(6 * i, 6 * i + 6)) : [];
177
+ if (box.length === 6 && box.every((value) => Number.isFinite(value))) {
178
+ aabbs.set(ids[i], {
179
+ min: [box[0], box[1], box[2]],
180
+ max: [box[3], box[4], box[5]],
181
+ });
182
+ }
183
+ }
184
+ }
185
+ finally {
186
+ // Freed before the next chunk's call, not batched up with the rest —
187
+ // this is the whole point of chunking: at most one batch's meshes
188
+ // are live in wasm memory at a time.
189
+ collection.free();
190
+ }
191
+ }
192
+ }
193
+ finally {
194
+ if (api.clearPrePassCache)
195
+ api.clearPrePassCache();
196
+ // `setSourceBytes` "REPLACES the previous file wholesale" (its own doc
197
+ // comment) — there is no dedicated release call, so installing an empty
198
+ // buffer is how this drops its reference to a possibly large file instead
199
+ // of leaving it resident on the wasm heap for the rest of the process.
200
+ if (useSource)
201
+ api.setSourceBytes(new Uint8Array(0));
202
+ }
203
+ return { hashes, aabbs, volumes, unitScale };
204
+ }
205
+ /**
206
+ * Attach one file's geometry pass onto the fingerprints already built for it
207
+ * (mutates in place — the fingerprints are freshly built per file, never
208
+ * shared, so this is not a hazard).
209
+ */
210
+ export function attachGeometryFingerprints(fingerprints, geometry) {
211
+ for (const fingerprint of fingerprints) {
212
+ const hash = geometry.hashes.get(fingerprint.ref);
213
+ if (hash !== undefined)
214
+ fingerprint.geometryHash = hash;
215
+ const aabb = geometry.aabbs.get(fingerprint.ref);
216
+ if (aabb !== undefined)
217
+ fingerprint.aabb = aabb;
218
+ const volume = geometry.volumes.get(fingerprint.ref);
219
+ if (volume !== undefined)
220
+ fingerprint.volume = volume;
221
+ }
222
+ }
223
+ /**
224
+ * The whole `--geometry` opt-in, as one call for `diff-content.ts`: lazily
225
+ * load the runtime, run the pass over both files, attach it to both sets of
226
+ * fingerprints, and report the resulting {@link DiffScope}. A missing runtime
227
+ * is reported through `warn` (a stderr line, not a thrown error) and the
228
+ * scope falls back to `'data'` — the rest of `--by-content` works fine
229
+ * without geometry, exactly as it always has.
230
+ *
231
+ * Frees the `IfcAPI` handle in `finally`, even if a pass throws (AGENTS.md
232
+ * "Geometry & WASM"). A pass that throws — a malformed or truncated model,
233
+ * or an internal wasm panic surfaced as a JS error — degrades to `'data'`
234
+ * scope with a warning rather than aborting the whole `--by-content` command
235
+ * (issue #4956 review): `--geometry` is opt-in extra evidence, and the
236
+ * data-only comparison underneath it is still a useful answer. Any
237
+ * `geometryHash`/`aabb`/`volume` a partial pass DID manage to attach before
238
+ * throwing is harmless left attached — `scope: 'data'` takes geometry out of
239
+ * the comparison regardless of what individual fingerprints carry.
240
+ */
241
+ export async function resolveGeometryScope(enabled, baseBytes, headBytes, baseFingerprints, headFingerprints, warn) {
242
+ if (!enabled)
243
+ return 'data';
244
+ const runtime = await loadWasmRuntime();
245
+ if (!runtime.ok) {
246
+ warn(runtime.message);
247
+ return 'data';
248
+ }
249
+ try {
250
+ attachGeometryFingerprints(baseFingerprints, runGeometryPass(runtime.runtime.api, baseBytes));
251
+ attachGeometryFingerprints(headFingerprints, runGeometryPass(runtime.runtime.api, headBytes));
252
+ return 'both';
253
+ }
254
+ catch (error) {
255
+ warn(`--geometry failed (${error.message}); continuing with data scope.`);
256
+ return 'data';
257
+ }
258
+ finally {
259
+ runtime.runtime.api.free();
260
+ }
261
+ }
262
+ //# sourceMappingURL=diff-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-geometry.js","sourceRoot":"","sources":["../../src/commands/diff-geometry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5C;;6DAE6D;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C;;8DAE8D;AAC9D,MAAM,CAAC,MAAM,2BAA2B,GACtC,kFAAkF;IAClF,wFAA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