@ifc-lite/mcp 0.16.0 → 0.18.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 +1 -1
  2. package/dist/authored-attribute-value.d.ts +3 -0
  3. package/dist/authored-attribute-value.d.ts.map +1 -0
  4. package/dist/authored-attribute-value.js +34 -0
  5. package/dist/authored-attribute-value.js.map +1 -0
  6. package/dist/backend-query-relationships.d.ts +5 -0
  7. package/dist/backend-query-relationships.d.ts.map +1 -0
  8. package/dist/backend-query-relationships.js +55 -0
  9. package/dist/backend-query-relationships.js.map +1 -0
  10. package/dist/backend-query.d.ts +3 -5
  11. package/dist/backend-query.d.ts.map +1 -1
  12. package/dist/backend-query.js +68 -106
  13. package/dist/backend-query.js.map +1 -1
  14. package/dist/headless-backend-cost-store.d.ts +14 -0
  15. package/dist/headless-backend-cost-store.d.ts.map +1 -0
  16. package/dist/headless-backend-cost-store.js +20 -0
  17. package/dist/headless-backend-cost-store.js.map +1 -0
  18. package/dist/headless-backend.d.ts +2 -1
  19. package/dist/headless-backend.d.ts.map +1 -1
  20. package/dist/headless-backend.js +10 -2
  21. package/dist/headless-backend.js.map +1 -1
  22. package/dist/overlay.d.ts +10 -22
  23. package/dist/overlay.d.ts.map +1 -1
  24. package/dist/overlay.js +44 -77
  25. package/dist/overlay.js.map +1 -1
  26. package/dist/tools/cost.d.ts +3 -0
  27. package/dist/tools/cost.d.ts.map +1 -0
  28. package/dist/tools/cost.js +59 -0
  29. package/dist/tools/cost.js.map +1 -0
  30. package/dist/tools/diff-authored-keys.d.ts +66 -0
  31. package/dist/tools/diff-authored-keys.d.ts.map +1 -0
  32. package/dist/tools/diff-authored-keys.js +144 -0
  33. package/dist/tools/diff-authored-keys.js.map +1 -0
  34. package/dist/tools/diff-content.d.ts +33 -0
  35. package/dist/tools/diff-content.d.ts.map +1 -0
  36. package/dist/tools/diff-content.js +158 -0
  37. package/dist/tools/diff-content.js.map +1 -0
  38. package/dist/tools/diff-fingerprints.d.ts +3 -1
  39. package/dist/tools/diff-fingerprints.d.ts.map +1 -1
  40. package/dist/tools/diff-fingerprints.js +19 -49
  41. package/dist/tools/diff-fingerprints.js.map +1 -1
  42. package/dist/tools/diff.d.ts.map +1 -1
  43. package/dist/tools/diff.js +33 -109
  44. package/dist/tools/diff.js.map +1 -1
  45. package/dist/tools/index.d.ts +2 -1
  46. package/dist/tools/index.d.ts.map +1 -1
  47. package/dist/tools/index.js +3 -1
  48. package/dist/tools/index.js.map +1 -1
  49. package/package.json +18 -18
@@ -0,0 +1,144 @@
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
+ * Attribute reading for the MCP diff adapter, and authored keys (issue #4955): `key_from` keys the
6
+ * comparison on `Tag` or a `Pset.Prop` instead of GlobalId. Read through the
7
+ * session OVERLAY, like every other fingerprinted value, so a queued edit or
8
+ * tombstone is what the comparison sees. Split out of `diff-fingerprints.ts`
9
+ * for size.
10
+ */
11
+ import { EntityExtractor, authoredKeyValue, extractRootAttributesFromEntity, getAttributeNamesAcrossSchemas, parseAuthoredKeySpec, } from '@ifc-lite/parser';
12
+ /** Prefix on a fingerprint key taken from an authored property rather than a GlobalId. */
13
+ export const AUTHORED_KEY_PREFIX = 'prop:';
14
+ /**
15
+ * A collision found on either revision invalidates that authored value on
16
+ * both. The first side may already have been built when the second reveals the
17
+ * collision, so repair its key back to the entity's GlobalId before diffing.
18
+ */
19
+ export function fallbackPairDuplicateAuthoredKeys(sides, duplicates) {
20
+ if (duplicates.size === 0)
21
+ return;
22
+ for (const { fingerprints, store } of sides) {
23
+ const extractor = new EntityExtractor(store.source);
24
+ for (const fingerprint of fingerprints) {
25
+ if (!fingerprint.key.startsWith(AUTHORED_KEY_PREFIX))
26
+ continue;
27
+ const value = fingerprint.key.slice(AUTHORED_KEY_PREFIX.length);
28
+ if (!duplicates.has(value))
29
+ continue;
30
+ const tableGlobalId = store.entities.getGlobalId(fingerprint.ref);
31
+ const ref = store.entityIndex.byId.get(fingerprint.ref);
32
+ const entity = ref ? extractor.extractEntity(ref) : undefined;
33
+ const sourceGlobalId = entity ? extractRootAttributesFromEntity(entity).globalId : undefined;
34
+ const globalId = tableGlobalId || sourceGlobalId;
35
+ if (!globalId) {
36
+ throw new Error(`Cannot restore GlobalId for authored-key collision on #${fingerprint.ref}`);
37
+ }
38
+ fingerprint.key = globalId;
39
+ }
40
+ }
41
+ }
42
+ /**
43
+ * Build the key resolver for one model: `prop:<value>` where the entity carries
44
+ * a non-empty value nobody else does, GlobalId otherwise. Duplicate values are
45
+ * reported on `options.duplicateAuthoredKeys`. Tombstoned entities are not
46
+ * owners: a deleted twin no longer contests the key. A created entity has no
47
+ * store row to read and keeps its GlobalId.
48
+ */
49
+ export function authoredKeyResolver(store, overlay, options, extractor, isDependentType) {
50
+ const keySpec = options.keyProperty ? parseAuthoredKeySpec(options.keyProperty) : undefined;
51
+ if (!keySpec)
52
+ return (_expressId, globalId) => globalId;
53
+ const authoredKeyOf = (expressId) => {
54
+ if (keySpec.kind === 'tag') {
55
+ const edited = overlay?.attributes(expressId).get('Tag');
56
+ if (edited !== undefined)
57
+ return edited.trim().length > 0 ? edited.trim() : undefined;
58
+ }
59
+ else if (overlay) {
60
+ const set = overlay.propertySets(expressId).find((pset) => pset.name === keySpec.pset);
61
+ const property = set?.properties.find((p) => p.name === keySpec.property);
62
+ if (set) {
63
+ const raw = property?.value;
64
+ if (raw === null || raw === undefined)
65
+ return undefined;
66
+ const value = typeof raw === 'object' ? JSON.stringify(raw) : String(raw);
67
+ return value.trim().length > 0 ? value.trim() : undefined;
68
+ }
69
+ }
70
+ return authoredKeyValue(store, expressId, keySpec, extractor);
71
+ };
72
+ // A first pass so a value two entities share can be refused for both,
73
+ // instead of the diff's first-wins index quietly keeping one.
74
+ const owners = new Map();
75
+ for (const [typeKey, ids] of store.entityIndex.byType) {
76
+ if (isDependentType(typeKey))
77
+ continue;
78
+ for (const expressId of ids) {
79
+ if (overlay?.deleted.has(expressId))
80
+ continue;
81
+ const value = authoredKeyOf(expressId);
82
+ if (value === undefined)
83
+ continue;
84
+ const list = owners.get(value);
85
+ if (list)
86
+ list.push(expressId);
87
+ else
88
+ owners.set(value, [expressId]);
89
+ }
90
+ }
91
+ for (const [value, ids] of owners) {
92
+ if (ids.length > 1)
93
+ options.duplicateAuthoredKeys?.set(value, ids);
94
+ }
95
+ return (expressId, globalId) => {
96
+ const value = authoredKeyOf(expressId);
97
+ if (value === undefined)
98
+ return globalId;
99
+ return (owners.get(value)?.length ?? 0) === 1 ? `${AUTHORED_KEY_PREFIX}${value}` : globalId;
100
+ };
101
+ }
102
+ /**
103
+ * One named attribute, read positionally through the **cross-schema** attribute
104
+ * list (issue #2021). The CLI's twin, and it must stay one.
105
+ *
106
+ * `extractAllEntityAttributes` names attributes through the parser's IFC4
107
+ * codegen pin, which answers an EMPTY list for a class the pin does not carry —
108
+ * so a `.find(name === 'Tag')` over it silently finds nothing on every
109
+ * IFC4X3-only type object (`IfcRailType`, `IfcTrackElementType`,
110
+ * `IfcSignalType`, …) while working perfectly on IFC2X3 and IFC4. That is a
111
+ * no-op nobody would notice: the entity is in scope, its class name is right,
112
+ * `isTypeObject` is right, and only the evidence is missing.
113
+ *
114
+ * This is the same pinned-registry family as the membership defect `#2001`
115
+ * fixed, and it has to be answered from the same place: the inheritance chain
116
+ * decides *whether* to read a `Tag`, so the attribute list that decides *where*
117
+ * it sits must span the same schemas. `getAttributeNamesAcrossSchemas` returns
118
+ * the pinned result unchanged for every class the pin does know, so this is
119
+ * additive — no IFC2X3 or IFC4 entity's hash moves because of it.
120
+ *
121
+ * Reads the raw STEP slot rather than reusing `extractAllEntityAttributes`'
122
+ * display normalization: this value is hashed, not shown, so `$` (absent) is
123
+ * the only case that needs interpreting and it arrives as null.
124
+ */
125
+ export function attributeAcrossSchemas(store, expressId, ifcType, attributeName) {
126
+ const index = getAttributeNamesAcrossSchemas(ifcType).indexOf(attributeName);
127
+ if (index < 0)
128
+ return undefined;
129
+ const ref = store.entityIndex.byId.get(expressId);
130
+ if (!ref)
131
+ return undefined;
132
+ const raw = new EntityExtractor(store.source).extractEntity(ref)?.attributes?.[index];
133
+ return typeof raw === 'string' || typeof raw === 'number' ? String(raw) : undefined;
134
+ }
135
+ /**
136
+ * An overlay override wins whenever one exists, including when it is empty —
137
+ * `entity_set_attribute` with `''` clears the attribute, and falling back to
138
+ * the stored value there would hash the edit away.
139
+ */
140
+ export function override(edited, stored) {
141
+ const value = edited !== undefined ? edited : stored;
142
+ return value ? value : undefined;
143
+ }
144
+ //# sourceMappingURL=diff-authored-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-authored-keys.js","sourceRoot":"","sources":["../../src/tools/diff-authored-keys.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,+BAA+B,EAC/B,8BAA8B,EAC9B,oBAAoB,GAErB,MAAM,kBAAkB,CAAC;AAW1B,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAC/C,KAGG,EACH,UAAyC;IAEzC,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAClC,KAAK,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,mBAAmB,CAAC;gBAAE,SAAS;YAC/D,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,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ACH,MAAM,UAAU,sBAAsB,CACpC,KAAmB,EACnB,SAAiB,EACjB,OAAe,EACf,aAAqB;IAErB,MAAM,KAAK,GAAG,8BAA8B,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;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;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAA0B,EAAE,MAA0B;IAC7E,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { type PendingOverlay } from '../overlay.js';
2
+ import type { LoadedModel } from '../context.js';
3
+ /** Default cap on the listed `contentMatches`. Per-kind totals are reported
4
+ * whole, so the cap bounds the payload without hiding anything. */
5
+ export declare const DEFAULT_MAX_MATCHES = 200;
6
+ /**
7
+ * Default cap on the GlobalIds listed per side of one match.
8
+ *
9
+ * `max_matches` bounds how many groups come back, not how big one is, and a
10
+ * `duplicated` / `deduplicated` / `ambiguous` group is a set of candidates that
11
+ * in a repetitive model can run to thousands of entities on each side. Without
12
+ * this, `max_matches: 1` could still return a model-sized payload and overflow
13
+ * the context window the cap exists to protect.
14
+ *
15
+ * 20 is chosen against what the list is *for*. A group is the engine declining
16
+ * to guess, so its members are a hand-off to the caller; twenty candidates on a
17
+ * side is already past what anyone resolves by reading a list rather than by
18
+ * querying the two models. The overwhelmingly common match is a 1:1 `renamed`
19
+ * pair, which this never touches. Every group still reports `baseCount` and
20
+ * `headCount` whole, computed before the cap for the same reason
21
+ * `contentMatchCounts` is: truncation must never be what makes a model look
22
+ * cleanly matched.
23
+ */
24
+ export declare const DEFAULT_MAX_GROUP_MEMBERS = 20;
25
+ /** Run the real `@ifc-lite/diff` engine over two loaded models. See the
26
+ * module doc for the scope and abstention contract. */
27
+ export declare function contentDiff(left: LoadedModel, right: LoadedModel, overlays: {
28
+ left: PendingOverlay | null;
29
+ right: PendingOverlay | null;
30
+ }, maxMatches: number, maxGroupMembers: number, keyProperty?: string, splitMerge?: boolean, successors?: boolean): Record<string, unknown>;
31
+ /** One-line human summary of the engine result, for the text block. */
32
+ export declare function describeCounts(content: Record<string, unknown>): string;
33
+ //# sourceMappingURL=diff-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-content.d.ts","sourceRoot":"","sources":["../../src/tools/diff-content.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;oEACoE;AACpE,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAiB5C;wDACwD;AACxD,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE;IAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,EACvE,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,OAAO,EACpB,UAAU,CAAC,EAAE,OAAO,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwFzB;AAgBD,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAOvE"}
@@ -0,0 +1,158 @@
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
+ * `model_diff`'s `by_content` half: the real `@ifc-lite/diff` engine run over
6
+ * two loaded models (issue #1891), plus `split_merge` / `successors`
7
+ * (issue #4956). Split out of `diff.ts` for size.
8
+ *
9
+ * **Data scope only.** This server has no geometry pipeline, so there is no
10
+ * world geometry hash and no bounding box; `scope: 'data'` is the honest
11
+ * description of what it can see, and every unambiguous 1:1 content match is
12
+ * therefore reported as `renamed` rather than `moved`/`reshaped`. `split_merge`
13
+ * and `successors` are geometry-only stages: they are threaded through to
14
+ * `diffModels` so the params exist and cost nothing today, but on this server
15
+ * they currently produce no claims either way (`diff.splitMerges` /
16
+ * `diff.successors` stay `undefined`, the engine's abstention) — they start
17
+ * producing claims the moment this server gains a geometry pass, with no
18
+ * further plumbing change. See `diff-fingerprints.ts`.
19
+ */
20
+ import { diffModels } from '@ifc-lite/diff';
21
+ import { buildModelFingerprints } from './diff-fingerprints.js';
22
+ import { fallbackPairDuplicateAuthoredKeys } from './diff-authored-keys.js';
23
+ import { pendingMutationsField } from '../overlay.js';
24
+ /** Default cap on the listed `contentMatches`. Per-kind totals are reported
25
+ * whole, so the cap bounds the payload without hiding anything. */
26
+ export const DEFAULT_MAX_MATCHES = 200;
27
+ /**
28
+ * Default cap on the GlobalIds listed per side of one match.
29
+ *
30
+ * `max_matches` bounds how many groups come back, not how big one is, and a
31
+ * `duplicated` / `deduplicated` / `ambiguous` group is a set of candidates that
32
+ * in a repetitive model can run to thousands of entities on each side. Without
33
+ * this, `max_matches: 1` could still return a model-sized payload and overflow
34
+ * the context window the cap exists to protect.
35
+ *
36
+ * 20 is chosen against what the list is *for*. A group is the engine declining
37
+ * to guess, so its members are a hand-off to the caller; twenty candidates on a
38
+ * side is already past what anyone resolves by reading a list rather than by
39
+ * querying the two models. The overwhelmingly common match is a 1:1 `renamed`
40
+ * pair, which this never touches. Every group still reports `baseCount` and
41
+ * `headCount` whole, computed before the cap for the same reason
42
+ * `contentMatchCounts` is: truncation must never be what makes a model look
43
+ * cleanly matched.
44
+ */
45
+ export const DEFAULT_MAX_GROUP_MEMBERS = 20;
46
+ /**
47
+ * Kinds an agent has to resolve itself, listed before the ones the engine
48
+ * already retired. Truncating the list must never be what drops the
49
+ * "we could not tell" groups.
50
+ */
51
+ const UNRESOLVED_FIRST = [
52
+ 'ambiguous',
53
+ 'duplicated',
54
+ 'deduplicated',
55
+ 'moved',
56
+ 'reshaped',
57
+ 'respecified',
58
+ 'renamed',
59
+ ];
60
+ /** Run the real `@ifc-lite/diff` engine over two loaded models. See the
61
+ * module doc for the scope and abstention contract. */
62
+ export function contentDiff(left, right, overlays, maxMatches, maxGroupMembers, keyProperty, splitMerge, successors) {
63
+ // Authored keys (issue #4955): `prop:<value>` where the model maintains one,
64
+ // GlobalId otherwise; a value two entities share is refused for both and
65
+ // reported so the agent sees why those two fell back.
66
+ const duplicateAuthoredKeys = new Map();
67
+ const adapter = { keyProperty, duplicateAuthoredKeys };
68
+ const baseFingerprints = buildModelFingerprints(left.store, overlays.left, adapter);
69
+ const headFingerprints = buildModelFingerprints(right.store, overlays.right, adapter);
70
+ fallbackPairDuplicateAuthoredKeys([
71
+ { fingerprints: baseFingerprints, store: left.store },
72
+ { fingerprints: headFingerprints, store: right.store },
73
+ ], duplicateAuthoredKeys);
74
+ const diff = diffModels(baseFingerprints, headFingerprints, {
75
+ scope: 'data',
76
+ matchUnpairedByContent: true,
77
+ detectSplitMerge: splitMerge,
78
+ detectSuccessors: successors,
79
+ });
80
+ const matches = [...(diff.contentMatches ?? [])].sort((a, b) => UNRESOLVED_FIRST.indexOf(a.kind) - UNRESOLVED_FIRST.indexOf(b.kind));
81
+ const byKind = {};
82
+ for (const match of matches)
83
+ byKind[match.kind] = (byKind[match.kind] ?? 0) + 1;
84
+ return {
85
+ scope: diff.scope,
86
+ keyProperty: keyProperty ?? null,
87
+ duplicateAuthoredKeys: [...duplicateAuthoredKeys.keys()].sort(),
88
+ counts: diff.counts,
89
+ // Whole totals, computed before the cap: an agent reading `contentMatches`
90
+ // can always tell whether the list it got is the whole story.
91
+ contentMatchCounts: byKind,
92
+ contentMatches: matches.slice(0, maxMatches).map((match) => ({
93
+ kind: match.kind,
94
+ ifcType: match.base[0]?.ifcType ?? match.head[0]?.ifcType,
95
+ // Groups are reported as groups. Collapsing a `duplicated` or
96
+ // `ambiguous` set to a single pair would be the engine guessing, which
97
+ // is exactly what it refuses to do (#1923). Long groups are cut to
98
+ // `maxGroupMembers` per side and say so, whole size included, so a cut
99
+ // group still reads as a group of that size.
100
+ ...listSide('base', match.base, maxGroupMembers),
101
+ ...listSide('head', match.head, maxGroupMembers),
102
+ ...(match.distance !== undefined ? { distance: match.distance } : {}),
103
+ })),
104
+ truncatedMatches: Math.max(0, matches.length - maxMatches),
105
+ // Absent (not `[]`) exactly when the stage did not run, or ran and the
106
+ // geometry abstention fired — this server's current state, always, until
107
+ // it has a geometry pipeline. The engine's "absent means not proved"
108
+ // contract, preserved rather than flattened.
109
+ splitMerges: diff.splitMerges?.map((claim) => ({
110
+ kind: claim.kind,
111
+ confidence: claim.confidence,
112
+ whole: claim.whole.key,
113
+ pieces: claim.pieces.map((piece) => piece.key),
114
+ })),
115
+ successors: diff.successors?.map((claim) => ({
116
+ confidence: claim.confidence,
117
+ base: claim.base.key,
118
+ head: claim.head.key,
119
+ overlap: claim.overlap,
120
+ distance: claim.distance,
121
+ })),
122
+ // Uncommitted edits are folded into the comparison; saying how many there
123
+ // are is what separates "the two files differ" from "this session has
124
+ // edits it has not written yet". Absent when neither model has any.
125
+ //
126
+ // `pendingMutations` is the scalar every other payload carries; the split a
127
+ // two-model comparison can additionally give lives under its own name rather
128
+ // than overloading that one.
129
+ ...pendingMutationsField(overlays.left, overlays.right),
130
+ ...(overlays.left || overlays.right
131
+ ? {
132
+ pendingMutationsBySide: {
133
+ base: overlays.left?.pendingMutations ?? 0,
134
+ head: overlays.right?.pendingMutations ?? 0,
135
+ },
136
+ }
137
+ : {}),
138
+ };
139
+ }
140
+ /** One side of a match: the (capped) keys, the whole count, and whether the
141
+ * list was cut. Emits `base`/`baseCount`/`baseTruncated` (or `head…`). */
142
+ function listSide(side, entities, maxGroupMembers) {
143
+ return {
144
+ [side]: entities.slice(0, maxGroupMembers).map((entity) => entity.key),
145
+ [`${side}Count`]: entities.length,
146
+ [`${side}Truncated`]: entities.length > maxGroupMembers,
147
+ };
148
+ }
149
+ /** One-line human summary of the engine result, for the text block. */
150
+ export function describeCounts(content) {
151
+ const counts = content.counts;
152
+ const byKind = content.contentMatchCounts;
153
+ const kinds = Object.entries(byKind).map(([kind, n]) => `${n} ${kind}`).join(', ');
154
+ return `${counts.added} added, ${counts.modified} modified, ${counts.deleted} deleted, `
155
+ + `${counts.unchanged} unchanged`
156
+ + (kinds ? `; content matches: ${kinds}` : '; no content matches');
157
+ }
158
+ //# sourceMappingURL=diff-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-content.js","sourceRoot":"","sources":["../../src/tools/diff-content.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAA4C,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAgB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,iCAAiC,EAAE,MAA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 +84,8 @@
84
84
  */
85
85
  import { type EntityFingerprint } from '@ifc-lite/diff';
86
86
  import { type IfcDataStore } from '@ifc-lite/parser';
87
+ import { type FingerprintAdapterOptions } from './diff-authored-keys.js';
88
+ export { AUTHORED_KEY_PREFIX, type FingerprintAdapterOptions } from './diff-authored-keys.js';
87
89
  import type { PendingOverlay } from '../overlay.js';
88
90
  /** Adapter handle threaded through the diff: the entity's express id. */
89
91
  export type DiffRef = number;
@@ -102,5 +104,5 @@ export type DiffRef = number;
102
104
  * values. Omitting it (the CLI twin has no session to overlay) is the original
103
105
  * store-only behaviour exactly.
104
106
  */
105
- export declare function buildModelFingerprints(store: IfcDataStore, overlay?: PendingOverlay | null): EntityFingerprint<DiffRef>[];
107
+ export declare function buildModelFingerprints(store: IfcDataStore, overlay?: PendingOverlay | null, options?: FingerprintAdapterOptions): EntityFingerprint<DiffRef>[];
106
108
  //# sourceMappingURL=diff-fingerprints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-fingerprints.d.ts","sourceRoot":"","sources":["../../src/tools/diff-fingerprints.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,yEAAyE;AACzE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAwE7B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,GAC9B,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAyD9B"}
1
+ {"version":3,"file":"diff-fingerprints.d.ts","sourceRoot":"","sources":["../../src/tools/diff-fingerprints.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAyD,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEhI,OAAO,EAAE,mBAAmB,EAAE,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,yEAAyE;AACzE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAwE7B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,EAC/B,OAAO,GAAE,yBAA8B,GACtC,iBAAiB,CAAC,OAAO,CAAC,EAAE,CA4D9B"}
@@ -86,9 +86,11 @@
86
86
  * fingerprints, which the paired tests check.
87
87
  */
88
88
  import { buildComponentFingerprints, buildDataFingerprint, } from '@ifc-lite/diff';
89
- import { RelationshipType } from '@ifc-lite/data';
90
- import { EntityExtractor, extractAllEntityAttributes, extractClassificationsOnDemand, extractProjectUnits, extractPropertiesOnDemand, extractQuantitiesOnDemand, extractRootAttributesFromEntity, getAttributeNamesAcrossSchemas, getInheritanceChainAcrossSchemas, quantitySiScale, roundToScale, scaledPropertyValue, } from '@ifc-lite/parser';
89
+ import { RelationshipType, resolvedTypeName } from '@ifc-lite/data';
90
+ import { EntityExtractor, extractAllEntityAttributes, extractClassificationsOnDemand, extractProjectUnits, extractPropertiesOnDemand, extractQuantitiesOnDemand, extractRootAttributesFromEntity, spatialContainerPath, getInheritanceChainAcrossSchemas, quantitySiScale, roundToScale, scaledPropertyValue, } from '@ifc-lite/parser';
91
+ import { attributeAcrossSchemas, authoredKeyResolver, override } from './diff-authored-keys.js';
91
92
  import { classificationLabel } from './diff-classification-label.js';
93
+ export { AUTHORED_KEY_PREFIX } from './diff-authored-keys.js';
92
94
  /**
93
95
  * Classify one STEP type against the three `IfcRoot` branches.
94
96
  *
@@ -157,13 +159,14 @@ function classifyType(typeKey) {
157
159
  * values. Omitting it (the CLI twin has no session to overlay) is the original
158
160
  * store-only behaviour exactly.
159
161
  */
160
- export function buildModelFingerprints(store, overlay) {
162
+ export function buildModelFingerprints(store, overlay, options = {}) {
161
163
  const fingerprints = [];
162
164
  const seen = new Set();
163
165
  // One extractor for the whole model: the source read below only fires for
164
166
  // the (small) set of object types the EntityTable declines to hold.
165
167
  const extractor = new EntityExtractor(store.source);
166
168
  const units = extractProjectUnits(store.source, store.entityIndex); // for quantitySiScale/scaledPropertyValue
169
+ const keyOf = authoredKeyResolver(store, overlay, options, extractor, (typeKey) => classifyType(typeKey).role === 'dependent');
167
170
  for (const [typeKey, ids] of store.entityIndex.byType) {
168
171
  // Classified once per type rather than once per entity — the geometry
169
172
  // buckets (IfcCartesianPoint, IfcPolyLoop, …) are the bulk of a real model
@@ -198,13 +201,17 @@ export function buildModelFingerprints(store, overlay) {
198
201
  // on every content match, so 'Unknown' would pair a task with an actor.
199
202
  const ifcType = source && (!tableType || tableType === 'Unknown') ? type.name : tableType;
200
203
  const input = buildDataInput(store, expressId, ifcType, source, type.typeObject, overlay, units);
201
- fingerprints.push({
202
- key: globalId,
204
+ const fingerprint = {
205
+ key: keyOf(expressId, globalId),
203
206
  ifcType,
204
207
  dataHash: buildDataFingerprint(input),
205
208
  components: buildComponentFingerprints(input),
206
209
  ref: expressId,
207
- });
210
+ };
211
+ const container = spatialContainerPath(store, expressId);
212
+ if (container !== undefined)
213
+ fingerprint.container = container;
214
+ fingerprints.push(fingerprint);
208
215
  }
209
216
  }
210
217
  for (const entity of overlay?.created ?? []) {
@@ -238,6 +245,11 @@ export function buildModelFingerprints(store, overlay) {
238
245
  * path exactly. Property sets and quantities never had the asymmetry — both
239
246
  * were already read through the overlay.
240
247
  *
248
+ * An authored key (`key_from`) is not resolved for a created entity either: it
249
+ * has no store row for `authoredKeyValue` to read, so it is keyed on the
250
+ * GlobalId the caller gave it. A created entity that duplicates a stored
251
+ * entity's authored value therefore reads as added rather than as a collision.
252
+ *
241
253
  * `predefinedType` and `typeAssignments` are necessarily absent: both are read
242
254
  * through the store, which has no row for an entity that exists only in the
243
255
  * overlay, and neither is reachable through `entity_set_attribute`. A created
@@ -333,7 +345,7 @@ overlay, units) {
333
345
  .map((typeId) => ({
334
346
  globalId: store.entities.getGlobalId(typeId) || undefined,
335
347
  name: store.entities.getName(typeId) || undefined,
336
- type: store.entities.getTypeName(typeId) || undefined,
348
+ type: resolvedTypeName(store.entities, typeId),
337
349
  }));
338
350
  const classifications = extractClassificationsOnDemand(store, expressId).map(classificationLabel);
339
351
  return {
@@ -357,46 +369,4 @@ overlay, units) {
357
369
  typeAssignments,
358
370
  };
359
371
  }
360
- /**
361
- * One named attribute, read positionally through the **cross-schema** attribute
362
- * list (issue #2021). The CLI's twin, and it must stay one.
363
- *
364
- * `extractAllEntityAttributes` names attributes through the parser's IFC4
365
- * codegen pin, which answers an EMPTY list for a class the pin does not carry —
366
- * so a `.find(name === 'Tag')` over it silently finds nothing on every
367
- * IFC4X3-only type object (`IfcRailType`, `IfcTrackElementType`,
368
- * `IfcSignalType`, …) while working perfectly on IFC2X3 and IFC4. That is a
369
- * no-op nobody would notice: the entity is in scope, its class name is right,
370
- * `isTypeObject` is right, and only the evidence is missing.
371
- *
372
- * This is the same pinned-registry family as the membership defect `#2001`
373
- * fixed, and it has to be answered from the same place: the inheritance chain
374
- * decides *whether* to read a `Tag`, so the attribute list that decides *where*
375
- * it sits must span the same schemas. `getAttributeNamesAcrossSchemas` returns
376
- * the pinned result unchanged for every class the pin does know, so this is
377
- * additive — no IFC2X3 or IFC4 entity's hash moves because of it.
378
- *
379
- * Reads the raw STEP slot rather than reusing `extractAllEntityAttributes`'
380
- * display normalization: this value is hashed, not shown, so `$` (absent) is
381
- * the only case that needs interpreting and it arrives as null.
382
- */
383
- function attributeAcrossSchemas(store, expressId, ifcType, attributeName) {
384
- const index = getAttributeNamesAcrossSchemas(ifcType).indexOf(attributeName);
385
- if (index < 0)
386
- return undefined;
387
- const ref = store.entityIndex.byId.get(expressId);
388
- if (!ref)
389
- return undefined;
390
- const raw = new EntityExtractor(store.source).extractEntity(ref)?.attributes?.[index];
391
- return typeof raw === 'string' || typeof raw === 'number' ? String(raw) : undefined;
392
- }
393
- /**
394
- * An overlay override wins whenever one exists, including when it is empty —
395
- * `entity_set_attribute` with `''` clears the attribute, and falling back to
396
- * the stored value there would hash the edit away.
397
- */
398
- function override(edited, stored) {
399
- const value = edited !== undefined ? edited : stored;
400
- return value ? value : undefined;
401
- }
402
372
  //# sourceMappingURL=diff-fingerprints.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-fingerprints.js","sourceRoot":"","sources":["../../src/tools/diff-fingerprints.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,gCAAgC,EAChC,eAAe,EACf,YAAY,EACZ,mBAAmB,GAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAuBrE;;;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BAAmB,CAAC,CAAC;IAClG,OAAO;QACL,OAAO;QACP,eAAe;QACf,wEAAwE;QACxE,4EAA4E;QAC5E,4EAA4E;QAC5E,2EAA2E;QAC3E,yEAAyE;QACzE,wBAAwB;QACxB,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,IAAI,CAAC;QACtF,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,WAAW,CAAC;QAClH,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,MAAM,EAAE,UAAU,CAAC;QAC9G,cAAc,EAAE,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3E,GAAG,EAAE,YAAY;YACf,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,SAAS;QACb,YAAY;QACZ,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAgWvC,eAAO,MAAM,SAAS,EAAE,IAAI,EAA8B,CAAC"}
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAwQvC,eAAO,MAAM,SAAS,EAAE,IAAI,EAA8B,CAAC"}