@holoscript/core 6.0.4 → 7.0.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.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/index.d.ts +501 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +105 -57
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
- package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
- package/dist/USDZExporter-NTMBNTDB.js +0 -707
- package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2CWOLHTE.js +0 -69
- package/dist/chunk-33LSUQDD.cjs +0 -835
- package/dist/chunk-3FJCK5XA.js +0 -2232
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3SAK5KFL.cjs +0 -83
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5BGSECRJ.cjs +0 -2237
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5O6TQC6M.cjs +0 -1871
- package/dist/chunk-5OEOHAAW.cjs +0 -682
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-5WUNN6ZN.cjs +0 -428
- package/dist/chunk-6TZPZCOJ.cjs +0 -1404
- package/dist/chunk-6UEHYZ7V.cjs +0 -773
- package/dist/chunk-6XSERL6L.js +0 -5678
- package/dist/chunk-72EQECGT.cjs +0 -908
- package/dist/chunk-7AGYRWKW.cjs +0 -507
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-ATSKSYVE.cjs +0 -51683
- package/dist/chunk-B5TCIAPQ.cjs +0 -117
- package/dist/chunk-BF2235SI.cjs +0 -5714
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BND3ST2K.cjs +0 -662
- package/dist/chunk-BU7VWW2K.js +0 -2522
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CAUCGUEA.cjs +0 -130
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-CDPGV4DN.js +0 -114
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CS2EMTGF.js +0 -1966
- package/dist/chunk-DMG7C4H2.js +0 -975
- package/dist/chunk-DXJQDCFL.js +0 -468
- package/dist/chunk-E3FWRT3Z.js +0 -608
- package/dist/chunk-E3UALNFA.js +0 -421
- package/dist/chunk-EONILVMF.js +0 -762
- package/dist/chunk-EQV4R3EV.cjs +0 -769
- package/dist/chunk-F3HH56EB.cjs +0 -5538
- package/dist/chunk-F4IULT7N.js +0 -1488
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-FFKU7BTK.cjs +0 -1046
- package/dist/chunk-FHQVYCH2.js +0 -70
- package/dist/chunk-FSF7EQVA.cjs +0 -1974
- package/dist/chunk-G4VZTCIB.js +0 -659
- package/dist/chunk-G7CT3EMP.cjs +0 -1002
- package/dist/chunk-GGHSW2NN.js +0 -51334
- package/dist/chunk-GVUR45UF.cjs +0 -777
- package/dist/chunk-H5Z7NASB.js +0 -9662
- package/dist/chunk-HE7ULERA.cjs +0 -697
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HPS76H7Q.js +0 -309
- package/dist/chunk-HQUEA5R6.cjs +0 -424
- package/dist/chunk-HYNTS5CP.js +0 -422
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IBDG74G2.cjs +0 -1219
- package/dist/chunk-IFNQFCTM.js +0 -3098
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-IWI6J7FX.js +0 -421
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-K6EKD26I.js +0 -630
- package/dist/chunk-KCQ5NDYC.cjs +0 -3172
- package/dist/chunk-KED34ILP.js +0 -832
- package/dist/chunk-KSGXLT74.cjs +0 -457
- package/dist/chunk-L4G4RLXX.js +0 -767
- package/dist/chunk-LDP5OK6G.js +0 -1216
- package/dist/chunk-LGGRPKTV.cjs +0 -735
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-LXJ4667L.cjs +0 -3874
- package/dist/chunk-LZ266PCM.cjs +0 -4499
- package/dist/chunk-MD6KDHVE.cjs +0 -237
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-MPXBVFHQ.js +0 -768
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-NDQNIJEH.js +0 -1715
- package/dist/chunk-NOZZ46QU.js +0 -168
- package/dist/chunk-OFKWH2IP.js +0 -449
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PMGODDJA.cjs +0 -319
- package/dist/chunk-Q4QX3AET.cjs +0 -1505
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-QLEAOI3Q.cjs +0 -424
- package/dist/chunk-R7MA7QWV.js +0 -732
- package/dist/chunk-RVYPEYPX.js +0 -678
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-S565K7NK.js +0 -752
- package/dist/chunk-SDAMZIRE.js +0 -765
- package/dist/chunk-T36DDXSF.js +0 -4250
- package/dist/chunk-T4NKMBDL.js +0 -5474
- package/dist/chunk-T7LEXZUZ.cjs +0 -2526
- package/dist/chunk-TEWCN33Y.js +0 -694
- package/dist/chunk-TQSZUOW5.cjs +0 -793
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-UERJ3YJV.js +0 -504
- package/dist/chunk-UPJBDCVF.js +0 -1395
- package/dist/chunk-V3NN3HPP.js +0 -4462
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-WB4Z63GG.js +0 -229
- package/dist/chunk-WDW67DZB.cjs +0 -9728
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X4ZF6CNE.cjs +0 -473
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
- package/dist/chunk-XCWFGZAA.js +0 -1043
- package/dist/chunk-XD6IYDUX.js +0 -903
- package/dist/chunk-XG23EUQX.cjs +0 -1717
- package/dist/chunk-XRKWN5PL.cjs +0 -173
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-XUTX5CBW.js +0 -126
- package/dist/chunk-XWPNTWDN.cjs +0 -755
- package/dist/chunk-XXINBTZK.cjs +0 -633
- package/dist/chunk-YCXFCXDS.js +0 -1868
- package/dist/chunk-YQK5JNFK.js +0 -3725
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-Z34RLXRA.cjs +0 -612
- package/dist/chunk-ZP4D3CSX.cjs +0 -72
- package/dist/cli/holoscript-runner.cjs +0 -2259
- package/dist/cli/holoscript-runner.js +0 -2234
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -28
- package/dist/compiler/agent-inference.js +0 -5
- package/dist/compiler/android-xr.cjs +0 -19
- package/dist/compiler/android-xr.js +0 -9
- package/dist/compiler/android.cjs +0 -20
- package/dist/compiler/android.js +0 -10
- package/dist/compiler/ar.cjs +0 -20
- package/dist/compiler/ar.js +0 -8
- package/dist/compiler/babylon.cjs +0 -17
- package/dist/compiler/babylon.js +0 -11
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -602
- package/dist/compiler/domain-block-utils.js +0 -8
- package/dist/compiler/dtdl.cjs +0 -24
- package/dist/compiler/dtdl.js +0 -8
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -15
- package/dist/compiler/godot.js +0 -9
- package/dist/compiler/incremental.cjs +0 -29
- package/dist/compiler/incremental.js +0 -4
- package/dist/compiler/index.cjs +0 -2578
- package/dist/compiler/index.js +0 -2383
- package/dist/compiler/ios.cjs +0 -20
- package/dist/compiler/ios.js +0 -10
- package/dist/compiler/multi-layer.cjs +0 -20
- package/dist/compiler/multi-layer.js +0 -11
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -15
- package/dist/compiler/openxr.js +0 -9
- package/dist/compiler/playcanvas.cjs +0 -16
- package/dist/compiler/playcanvas.js +0 -10
- package/dist/compiler/r3f.cjs +0 -34
- package/dist/compiler/r3f.js +0 -12
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -21
- package/dist/compiler/sdf.js +0 -9
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -17
- package/dist/compiler/state.js +0 -7
- package/dist/compiler/trait-composition.cjs +0 -26
- package/dist/compiler/trait-composition.js +0 -5
- package/dist/compiler/unity.cjs +0 -15
- package/dist/compiler/unity.js +0 -9
- package/dist/compiler/unreal.cjs +0 -19
- package/dist/compiler/unreal.js +0 -9
- package/dist/compiler/urdf.cjs +0 -45
- package/dist/compiler/urdf.js +0 -9
- package/dist/compiler/usd-physics.cjs +0 -23
- package/dist/compiler/usd-physics.js +0 -6
- package/dist/compiler/visionos.cjs +0 -15
- package/dist/compiler/visionos.js +0 -9
- package/dist/compiler/vrchat.cjs +0 -19
- package/dist/compiler/vrchat.js +0 -9
- package/dist/compiler/vrr.cjs +0 -21
- package/dist/compiler/vrr.js +0 -9
- package/dist/compiler/wasm.cjs +0 -33
- package/dist/compiler/wasm.js +0 -9
- package/dist/compiler/webgpu.cjs +0 -15
- package/dist/compiler/webgpu.js +0 -9
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -68
- package/dist/entries/scripting.js +0 -11
- package/dist/index.cjs +0 -40921
- package/dist/index.js +0 -37763
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
- package/dist/ml-dsa-WYLJHJO6.js +0 -1178
- package/dist/parser.cjs +0 -27
- package/dist/parser.js +0 -10
- package/dist/playwright-5OSAPTNH.js +0 -98660
- package/dist/playwright-RL6GY4F7.cjs +0 -98673
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14649
- package/dist/traits/index.js +0 -12243
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
package/dist/chunk-A7PIMZGU.js
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { __esm } from './chunk-2CWOLHTE.js';
|
|
2
|
-
|
|
3
|
-
// src/compiler/traits/Semiring.ts
|
|
4
|
-
function minPlusMul(a, b) {
|
|
5
|
-
return !Number.isFinite(a) || !Number.isFinite(b) ? Number.POSITIVE_INFINITY : a + b;
|
|
6
|
-
}
|
|
7
|
-
function maxPlusMul(a, b) {
|
|
8
|
-
return !Number.isFinite(a) || !Number.isFinite(b) ? Number.NEGATIVE_INFINITY : a + b;
|
|
9
|
-
}
|
|
10
|
-
function strategyToSemiring(strategy) {
|
|
11
|
-
switch (strategy) {
|
|
12
|
-
case "sum":
|
|
13
|
-
case "multiply":
|
|
14
|
-
return SumProductSemiring;
|
|
15
|
-
case "tropical-min-plus":
|
|
16
|
-
return MinPlusSemiring;
|
|
17
|
-
case "tropical-max-plus":
|
|
18
|
-
return MaxPlusSemiring;
|
|
19
|
-
default:
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
var MinPlusSemiring, MaxPlusSemiring, SumProductSemiring;
|
|
24
|
-
var init_Semiring = __esm({
|
|
25
|
-
"src/compiler/traits/Semiring.ts"() {
|
|
26
|
-
MinPlusSemiring = {
|
|
27
|
-
zero: Number.POSITIVE_INFINITY,
|
|
28
|
-
one: 0,
|
|
29
|
-
add: (a, b) => Math.min(a, b),
|
|
30
|
-
mul: minPlusMul
|
|
31
|
-
};
|
|
32
|
-
MaxPlusSemiring = {
|
|
33
|
-
zero: Number.NEGATIVE_INFINITY,
|
|
34
|
-
one: 0,
|
|
35
|
-
add: (a, b) => Math.max(a, b),
|
|
36
|
-
mul: maxPlusMul
|
|
37
|
-
};
|
|
38
|
-
SumProductSemiring = {
|
|
39
|
-
zero: 0,
|
|
40
|
-
one: 1,
|
|
41
|
-
add: (a, b) => a + b,
|
|
42
|
-
mul: (a, b) => a * b
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// src/compiler/traits/ProvenanceSemiring.ts
|
|
48
|
-
function isDeadElement(value) {
|
|
49
|
-
return value === TRAIT_ZERO;
|
|
50
|
-
}
|
|
51
|
-
function createDeadElement(subsystem, elementId, reason, originalValue) {
|
|
52
|
-
return {
|
|
53
|
-
subsystem,
|
|
54
|
-
reason,
|
|
55
|
-
determinedAt: Date.now(),
|
|
56
|
-
elementId,
|
|
57
|
-
originalValue
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function authorityWeight(level, reputationScore) {
|
|
61
|
-
const clamped = Math.max(0, Math.min(100, level));
|
|
62
|
-
let baseWeight = 0.5 + clamped / 100 * 1.5;
|
|
63
|
-
if (reputationScore !== void 0 && reputationScore > 0) {
|
|
64
|
-
if (reputationScore >= 100)
|
|
65
|
-
baseWeight *= 3;
|
|
66
|
-
else if (reputationScore >= 30)
|
|
67
|
-
baseWeight *= 2;
|
|
68
|
-
else if (reputationScore >= 5) baseWeight *= 1.5;
|
|
69
|
-
}
|
|
70
|
-
return baseWeight;
|
|
71
|
-
}
|
|
72
|
-
var TRAIT_ZERO, AuthorityTier, ProvenanceSemiring;
|
|
73
|
-
var init_ProvenanceSemiring = __esm({
|
|
74
|
-
"src/compiler/traits/ProvenanceSemiring.ts"() {
|
|
75
|
-
init_Semiring();
|
|
76
|
-
TRAIT_ZERO = /* @__PURE__ */ Symbol.for("HoloScript::TraitZero");
|
|
77
|
-
AuthorityTier = /* @__PURE__ */ ((AuthorityTier2) => {
|
|
78
|
-
AuthorityTier2[AuthorityTier2["GUEST"] = 0] = "GUEST";
|
|
79
|
-
AuthorityTier2[AuthorityTier2["AGENT"] = 25] = "AGENT";
|
|
80
|
-
AuthorityTier2[AuthorityTier2["MEMBER"] = 50] = "MEMBER";
|
|
81
|
-
AuthorityTier2[AuthorityTier2["ADMIN"] = 75] = "ADMIN";
|
|
82
|
-
AuthorityTier2[AuthorityTier2["FOUNDER"] = 100] = "FOUNDER";
|
|
83
|
-
return AuthorityTier2;
|
|
84
|
-
})(AuthorityTier || {});
|
|
85
|
-
ProvenanceSemiring = class {
|
|
86
|
-
constructor(rules) {
|
|
87
|
-
this.rules = /* @__PURE__ */ new Map();
|
|
88
|
-
if (rules) {
|
|
89
|
-
for (const rule of rules) {
|
|
90
|
-
this.rules.set(rule.property, rule);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
this.loadDefaultRules();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
loadDefaultRules() {
|
|
97
|
-
this.rules.set("type", {
|
|
98
|
-
property: "type",
|
|
99
|
-
strategy: "domain-override",
|
|
100
|
-
precedence: ["kinematic", "physics", "collidable", "static"]
|
|
101
|
-
});
|
|
102
|
-
this.rules.set("mass", { property: "mass", strategy: "authority-weighted" });
|
|
103
|
-
this.rules.set("friction", { property: "friction", strategy: "max" });
|
|
104
|
-
this.rules.set("restitution", { property: "restitution", strategy: "min" });
|
|
105
|
-
this.rules.set("color", {
|
|
106
|
-
property: "color",
|
|
107
|
-
strategy: "domain-override",
|
|
108
|
-
precedence: ["material", "color", "hoverable", "glowing"]
|
|
109
|
-
});
|
|
110
|
-
this.rules.set("opacity", { property: "opacity", strategy: "min" });
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Commutative addition (⊕)
|
|
114
|
-
* Merges multiple traits into a unified provenanced configuration map.
|
|
115
|
-
*/
|
|
116
|
-
add(traits) {
|
|
117
|
-
const acc = {};
|
|
118
|
-
const conflicts = [];
|
|
119
|
-
const errors = [];
|
|
120
|
-
const deadElements = [];
|
|
121
|
-
for (const trait of traits) {
|
|
122
|
-
for (const [key, value] of Object.entries(trait.config)) {
|
|
123
|
-
if (value === TRAIT_ZERO) {
|
|
124
|
-
deadElements.push(
|
|
125
|
-
createDeadElement(
|
|
126
|
-
"semiring",
|
|
127
|
-
`${trait.name}.${key}`,
|
|
128
|
-
`TRAIT_ZERO encountered during addition: property '${key}' from @${trait.name}`
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (!(key in acc)) {
|
|
134
|
-
acc[key] = { value, source: trait.name, context: trait.context };
|
|
135
|
-
} else {
|
|
136
|
-
const existing = acc[key];
|
|
137
|
-
try {
|
|
138
|
-
acc[key] = this.multiply(
|
|
139
|
-
existing,
|
|
140
|
-
{ value, source: trait.name, context: trait.context },
|
|
141
|
-
key
|
|
142
|
-
);
|
|
143
|
-
conflicts.push(
|
|
144
|
-
`Resolved conflict on property '${key}' between @${existing.source} and @${trait.name}`
|
|
145
|
-
);
|
|
146
|
-
} catch (err) {
|
|
147
|
-
errors.push(err instanceof Error ? err.message : String(err));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
const finalConfig = {};
|
|
153
|
-
for (const [k, v] of Object.entries(acc)) {
|
|
154
|
-
finalConfig[k] = v.value;
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
config: finalConfig,
|
|
158
|
-
provenance: acc,
|
|
159
|
-
conflicts,
|
|
160
|
-
errors,
|
|
161
|
-
deadElements
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Semiring multiplication (⊗)
|
|
166
|
-
* Resolves conflicts based on loaded domain rules, enforcing commutativity.
|
|
167
|
-
*
|
|
168
|
-
* C1 FIX: Authority no longer bypasses rules. Instead, authority modulates
|
|
169
|
-
* the weight within rule resolution. Higher authority = higher weight in
|
|
170
|
-
* numeric strategies, tiebreaker in domain-override. This ensures the
|
|
171
|
-
* algebraic structure is preserved — crossing an authority threshold
|
|
172
|
-
* changes the WEIGHT of a resolution, not the MECHANISM.
|
|
173
|
-
*/
|
|
174
|
-
multiply(a, b, property) {
|
|
175
|
-
if (a.value === TRAIT_ZERO) return a;
|
|
176
|
-
if (b.value === TRAIT_ZERO) return b;
|
|
177
|
-
if (a.value === b.value) return a;
|
|
178
|
-
const rule = this.rules.get(property);
|
|
179
|
-
if (!rule) {
|
|
180
|
-
const authA = a.context?.authorityLevel ?? 0;
|
|
181
|
-
const authB = b.context?.authorityLevel ?? 0;
|
|
182
|
-
if (authA !== authB) {
|
|
183
|
-
return authA > authB ? a : b;
|
|
184
|
-
}
|
|
185
|
-
throw new Error(
|
|
186
|
-
`Unresolved conflict on '${property}': @${a.source} (${a.value}) vs @${b.source} (${b.value})`
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
const weightA = authorityWeight(a.context?.authorityLevel ?? 0, a.context?.reputationScore);
|
|
190
|
-
const weightB = authorityWeight(b.context?.authorityLevel ?? 0, b.context?.reputationScore);
|
|
191
|
-
if (rule && (rule.strategy === "tropical-min-plus" || rule.strategy === "tropical-max-plus")) {
|
|
192
|
-
const semiring = strategyToSemiring(rule.strategy);
|
|
193
|
-
if (!semiring) {
|
|
194
|
-
throw new Error(`No semiring adapter available for strategy '${rule.strategy}'`);
|
|
195
|
-
}
|
|
196
|
-
return {
|
|
197
|
-
value: semiring.mul(a.value, b.value),
|
|
198
|
-
source: `${a.source}\u2297${b.source}`,
|
|
199
|
-
context: weightA >= weightB ? a.context : b.context
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
switch (rule.strategy) {
|
|
203
|
-
case "max":
|
|
204
|
-
return {
|
|
205
|
-
value: Math.max(a.value, b.value),
|
|
206
|
-
source: a.value > b.value ? a.source : b.source
|
|
207
|
-
};
|
|
208
|
-
case "min":
|
|
209
|
-
return {
|
|
210
|
-
value: Math.min(a.value, b.value),
|
|
211
|
-
source: a.value < b.value ? a.source : b.source
|
|
212
|
-
};
|
|
213
|
-
case "sum":
|
|
214
|
-
return {
|
|
215
|
-
value: a.value + b.value,
|
|
216
|
-
source: `${a.source}+${b.source}`
|
|
217
|
-
};
|
|
218
|
-
case "multiply":
|
|
219
|
-
return {
|
|
220
|
-
value: a.value * b.value,
|
|
221
|
-
source: `${a.source}*${b.source}`
|
|
222
|
-
};
|
|
223
|
-
case "authority-weighted": {
|
|
224
|
-
const scaledA = a.value * weightA;
|
|
225
|
-
const scaledB = b.value * weightB;
|
|
226
|
-
return scaledA >= scaledB ? { value: a.value, source: a.source, context: a.context } : { value: b.value, source: b.source, context: b.context };
|
|
227
|
-
}
|
|
228
|
-
case "domain-override": {
|
|
229
|
-
const precedence = rule.precedence || [];
|
|
230
|
-
const aIndex = precedence.indexOf(a.source);
|
|
231
|
-
const bIndex = precedence.indexOf(b.source);
|
|
232
|
-
if (aIndex !== -1 && bIndex !== -1) {
|
|
233
|
-
if (aIndex === bIndex) {
|
|
234
|
-
return weightA >= weightB ? a : b;
|
|
235
|
-
}
|
|
236
|
-
return aIndex < bIndex ? a : b;
|
|
237
|
-
} else if (aIndex !== -1) {
|
|
238
|
-
return a;
|
|
239
|
-
} else if (bIndex !== -1) {
|
|
240
|
-
return b;
|
|
241
|
-
} else {
|
|
242
|
-
if (weightA !== weightB) {
|
|
243
|
-
return weightA > weightB ? a : b;
|
|
244
|
-
}
|
|
245
|
-
throw new Error(
|
|
246
|
-
`Unresolved domain override on '${property}': @${a.source} vs @${b.source}`
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
case "strict-error":
|
|
251
|
-
default:
|
|
252
|
-
throw new Error(
|
|
253
|
-
`Composition conflict: @${a.source} and @${b.source} both supply '${property}' = ${a.value} vs ${b.value}`
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
export { AuthorityTier, MaxPlusSemiring, MinPlusSemiring, ProvenanceSemiring, SumProductSemiring, TRAIT_ZERO, authorityWeight, createDeadElement, init_ProvenanceSemiring, init_Semiring, isDeadElement, strategyToSemiring };
|
|
262
|
-
//# sourceMappingURL=chunk-A7PIMZGU.js.map
|
|
263
|
-
//# sourceMappingURL=chunk-A7PIMZGU.js.map
|