@holoscript/core 6.0.3 → 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/README.md +40 -40
- package/dist/codebase/index.d.ts +25 -0
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +4 -0
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/entries/interop.d.ts +9 -0
- package/dist/entries/scripting.d.ts +7 -0
- package/dist/index.d.ts +520 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/self-improvement/index.d.ts +0 -48
- package/dist/storage/index.d.ts +24 -0
- package/dist/tools/index.d.ts +33 -0
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +102 -19
- package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
- package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
- package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
- package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
- package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
- package/dist/USDZExporter-YA55ZS35.js +0 -707
- package/dist/chunk-26TLYBFD.js +0 -309
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2UX5LRAP.cjs +0 -833
- package/dist/chunk-32TWR3HE.js +0 -70
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3KEU5QYY.cjs +0 -175
- package/dist/chunk-4FCZDTD5.js +0 -610
- package/dist/chunk-4KJ2R7VP.cjs +0 -507
- package/dist/chunk-4SMUJFHL.js +0 -1213
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-65RFOWZI.js +0 -765
- package/dist/chunk-6OQBLABR.js +0 -5240
- package/dist/chunk-6WNCRE6F.js +0 -126
- package/dist/chunk-74YCHHTE.js +0 -1872
- package/dist/chunk-7H5UNJZD.cjs +0 -1973
- package/dist/chunk-7KPI4EKH.cjs +0 -701
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-7N3JIJMT.js +0 -1395
- package/dist/chunk-7X2IEJIE.cjs +0 -2526
- package/dist/chunk-A6GO3DPZ.cjs +0 -1002
- package/dist/chunk-AC4BSHFV.js +0 -765
- package/dist/chunk-AIUXRS74.cjs +0 -3681
- package/dist/chunk-ARNKA274.cjs +0 -130
- package/dist/chunk-AW7WAELW.js +0 -975
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BO2OKHIY.js +0 -6055
- package/dist/chunk-BU5ZAFMC.js +0 -115
- package/dist/chunk-BY3B7ZYV.cjs +0 -457
- package/dist/chunk-C2QHVHZF.js +0 -4066
- package/dist/chunk-C7BNX4XJ.js +0 -1043
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CMYAWUX3.js +0 -4455
- package/dist/chunk-CN4NOESF.cjs +0 -416
- package/dist/chunk-CNVM7J3M.js +0 -883
- package/dist/chunk-CO2VM2DK.js +0 -1965
- package/dist/chunk-CQDOF3G7.cjs +0 -1404
- package/dist/chunk-DH5G2JUA.cjs +0 -614
- package/dist/chunk-DIEDKX5B.cjs +0 -660
- package/dist/chunk-DN7UFU63.cjs +0 -172
- package/dist/chunk-DXVCEFZB.js +0 -2027
- package/dist/chunk-EGIZHYJP.cjs +0 -85
- package/dist/chunk-EJA7G2C4.cjs +0 -428
- package/dist/chunk-ELLQPFAF.js +0 -830
- package/dist/chunk-EMO7HAKJ.cjs +0 -1875
- package/dist/chunk-ENV7K6XA.js +0 -282
- package/dist/chunk-EPWRXL6S.js +0 -2522
- package/dist/chunk-EUFLX2PI.js +0 -56956
- package/dist/chunk-F5LVGHNT.js +0 -449
- package/dist/chunk-FEFHPUEM.cjs +0 -6122
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-GC3YU46J.js +0 -762
- package/dist/chunk-H6WMMLQK.cjs +0 -4492
- package/dist/chunk-H7XMORZI.js +0 -2731
- package/dist/chunk-HAN4V3PF.cjs +0 -2037
- package/dist/chunk-HBZYCASG.js +0 -4208
- package/dist/chunk-HF4OFY25.cjs +0 -4097
- package/dist/chunk-HHS6FMOU.cjs +0 -3813
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HKCVM6OK.cjs +0 -2237
- package/dist/chunk-HUFNKFA6.js +0 -698
- package/dist/chunk-I3XGTIHM.cjs +0 -1505
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-KDB6BUMB.js +0 -3666
- package/dist/chunk-KUJRR4FJ.js +0 -657
- package/dist/chunk-KYM4XRFG.js +0 -421
- package/dist/chunk-L3Z2HIWJ.cjs +0 -793
- package/dist/chunk-LBPEZQAF.js +0 -2232
- package/dist/chunk-LER4WXW5.cjs +0 -286
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-M6FU6S22.js +0 -2911
- package/dist/chunk-MWEFR6YQ.js +0 -1857
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUHGRTZ.js +0 -752
- package/dist/chunk-NKRKT6V2.js +0 -69
- package/dist/chunk-NLPSZT4C.js +0 -630
- package/dist/chunk-NRUB55IT.cjs +0 -771
- package/dist/chunk-NTMZSDXM.cjs +0 -633
- package/dist/chunk-ODGMVILH.js +0 -9662
- package/dist/chunk-PBA6NXCT.cjs +0 -1216
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PJMOXFPR.cjs +0 -1861
- package/dist/chunk-PLMYCCA4.js +0 -504
- package/dist/chunk-PPULB4GG.cjs +0 -9728
- package/dist/chunk-PQLGZKMC.cjs +0 -755
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-QHVVVN47.cjs +0 -2033
- package/dist/chunk-QWKUKVRE.js +0 -2026
- package/dist/chunk-RE3OKSYF.cjs +0 -424
- package/dist/chunk-RT7LJRSF.cjs +0 -57378
- package/dist/chunk-SPDELRRV.cjs +0 -319
- package/dist/chunk-SUCBB66F.js +0 -229
- package/dist/chunk-TSWTWZ42.cjs +0 -4214
- package/dist/chunk-UITWA6DV.cjs +0 -2829
- package/dist/chunk-UQW6SLM5.js +0 -172
- package/dist/chunk-V2ILLPHK.cjs +0 -237
- package/dist/chunk-V42NTCFH.js +0 -3645
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-VJVCD5T5.cjs +0 -769
- package/dist/chunk-VK5AXKO3.js +0 -746
- package/dist/chunk-VSXOIUCF.cjs +0 -473
- package/dist/chunk-VZNKJZTT.cjs +0 -749
- package/dist/chunk-W76ETJTI.js +0 -678
- package/dist/chunk-WFJIDI2N.cjs +0 -424
- package/dist/chunk-WN3YF33G.cjs +0 -118
- package/dist/chunk-WUXIRGZP.cjs +0 -2915
- package/dist/chunk-WYH4GVZ5.js +0 -1488
- package/dist/chunk-X4YVN7H3.cjs +0 -888
- package/dist/chunk-X67XRI2T.js +0 -410
- package/dist/chunk-XDXZM3ZP.cjs +0 -1046
- package/dist/chunk-XH7SE4HH.cjs +0 -72
- package/dist/chunk-XNMEH2BI.js +0 -126
- package/dist/chunk-XSF76QRU.js +0 -468
- package/dist/chunk-XSUZMPVQ.cjs +0 -682
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-Y5MUAYTO.js +0 -167
- package/dist/chunk-Y7VK5TH3.cjs +0 -129
- package/dist/chunk-YCMQQQ5U.cjs +0 -5244
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-ZGTGVSTZ.js +0 -422
- package/dist/chunk-ZL6VJ6SN.js +0 -421
- package/dist/cli/holoscript-runner.cjs +0 -2258
- package/dist/cli/holoscript-runner.js +0 -2233
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -29
- package/dist/compiler/agent-inference.js +0 -6
- package/dist/compiler/android-xr.cjs +0 -20
- package/dist/compiler/android-xr.js +0 -10
- package/dist/compiler/android.cjs +0 -21
- package/dist/compiler/android.js +0 -11
- package/dist/compiler/ar.cjs +0 -21
- package/dist/compiler/ar.js +0 -9
- package/dist/compiler/babylon.cjs +0 -18
- package/dist/compiler/babylon.js +0 -12
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -595
- package/dist/compiler/domain-block-utils.js +0 -9
- package/dist/compiler/dtdl.cjs +0 -25
- package/dist/compiler/dtdl.js +0 -9
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -16
- package/dist/compiler/godot.js +0 -10
- package/dist/compiler/incremental.cjs +0 -30
- package/dist/compiler/incremental.js +0 -5
- package/dist/compiler/index.cjs +0 -1522
- package/dist/compiler/index.js +0 -1321
- package/dist/compiler/ios.cjs +0 -21
- package/dist/compiler/ios.js +0 -11
- package/dist/compiler/multi-layer.cjs +0 -27
- package/dist/compiler/multi-layer.js +0 -12
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -16
- package/dist/compiler/openxr.js +0 -10
- package/dist/compiler/playcanvas.cjs +0 -17
- package/dist/compiler/playcanvas.js +0 -11
- package/dist/compiler/r3f.cjs +0 -35
- package/dist/compiler/r3f.js +0 -13
- 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 -22
- package/dist/compiler/sdf.js +0 -10
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -18
- package/dist/compiler/state.js +0 -8
- package/dist/compiler/trait-composition.cjs +0 -27
- package/dist/compiler/trait-composition.js +0 -6
- package/dist/compiler/unity.cjs +0 -16
- package/dist/compiler/unity.js +0 -10
- package/dist/compiler/unreal.cjs +0 -20
- package/dist/compiler/unreal.js +0 -10
- package/dist/compiler/urdf.cjs +0 -46
- package/dist/compiler/urdf.js +0 -10
- package/dist/compiler/usd-physics.cjs +0 -24
- package/dist/compiler/usd-physics.js +0 -7
- package/dist/compiler/visionos.cjs +0 -16
- package/dist/compiler/visionos.js +0 -10
- package/dist/compiler/vrchat.cjs +0 -20
- package/dist/compiler/vrchat.js +0 -10
- package/dist/compiler/vrr.cjs +0 -22
- package/dist/compiler/vrr.js +0 -10
- package/dist/compiler/wasm.cjs +0 -34
- package/dist/compiler/wasm.js +0 -10
- package/dist/compiler/webgpu.cjs +0 -16
- package/dist/compiler/webgpu.js +0 -10
- 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 -67
- package/dist/entries/scripting.js +0 -10
- package/dist/index.cjs +0 -61703
- package/dist/index.js +0 -58652
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/parser.cjs +0 -26
- package/dist/parser.js +0 -9
- package/dist/playwright-7DTEQCBD.cjs +0 -98673
- package/dist/playwright-BIZXMLD2.js +0 -98660
- package/dist/post-quantum-JTTAAGO3.cjs +0 -6
- package/dist/post-quantum-RVPVDEPI.js +0 -4
- 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 -14331
- package/dist/traits/index.js +0 -12126
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
- package/dist/wot/index.cjs +0 -29
- package/dist/wot/index.js +0 -4
package/dist/chunk-3FYZOR7S.cjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/math/vec3.ts
|
|
4
|
-
function vec3NormalizeInPlace(v) {
|
|
5
|
-
const len = Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
|
6
|
-
if (len > 1e-8) {
|
|
7
|
-
v[0] /= len;
|
|
8
|
-
v[1] /= len;
|
|
9
|
-
v[2] /= len;
|
|
10
|
-
}
|
|
11
|
-
return len;
|
|
12
|
-
}
|
|
13
|
-
function vec3Normalize(v) {
|
|
14
|
-
const len = Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
15
|
-
if (len === 0) return { x: 0, y: 0, z: 0 };
|
|
16
|
-
return { x: v.x / len, y: v.y / len, z: v.z / len };
|
|
17
|
-
}
|
|
18
|
-
function vec3Length(v) {
|
|
19
|
-
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
20
|
-
}
|
|
21
|
-
function vec3Cross(a, b) {
|
|
22
|
-
return {
|
|
23
|
-
x: a.y * b.z - a.z * b.y,
|
|
24
|
-
y: a.z * b.x - a.x * b.z,
|
|
25
|
-
z: a.x * b.y - a.y * b.x
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function vec3CrossArray(a, b) {
|
|
29
|
-
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
30
|
-
}
|
|
31
|
-
function vec3Sub(a, b) {
|
|
32
|
-
return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
|
|
33
|
-
}
|
|
34
|
-
function vec3SubArray(a, b) {
|
|
35
|
-
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
36
|
-
}
|
|
37
|
-
function vec3Add(a, b) {
|
|
38
|
-
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
39
|
-
}
|
|
40
|
-
function vec3Scale(v, s) {
|
|
41
|
-
return { x: v.x * s, y: v.y * s, z: v.z * s };
|
|
42
|
-
}
|
|
43
|
-
function vec3ScaleArray(v, s) {
|
|
44
|
-
return [v[0] * s, v[1] * s, v[2] * s];
|
|
45
|
-
}
|
|
46
|
-
function vec3Distance(a, b) {
|
|
47
|
-
const dx = b.x - a.x;
|
|
48
|
-
const dy = b.y - a.y;
|
|
49
|
-
const dz = b.z - a.z;
|
|
50
|
-
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
51
|
-
}
|
|
52
|
-
function vec3Dot(a, b) {
|
|
53
|
-
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
exports.vec3Add = vec3Add;
|
|
57
|
-
exports.vec3Cross = vec3Cross;
|
|
58
|
-
exports.vec3CrossArray = vec3CrossArray;
|
|
59
|
-
exports.vec3Distance = vec3Distance;
|
|
60
|
-
exports.vec3Dot = vec3Dot;
|
|
61
|
-
exports.vec3Length = vec3Length;
|
|
62
|
-
exports.vec3Normalize = vec3Normalize;
|
|
63
|
-
exports.vec3NormalizeInPlace = vec3NormalizeInPlace;
|
|
64
|
-
exports.vec3Scale = vec3Scale;
|
|
65
|
-
exports.vec3ScaleArray = vec3ScaleArray;
|
|
66
|
-
exports.vec3Sub = vec3Sub;
|
|
67
|
-
exports.vec3SubArray = vec3SubArray;
|
|
68
|
-
//# sourceMappingURL=chunk-3FYZOR7S.cjs.map
|
|
69
|
-
//# sourceMappingURL=chunk-3FYZOR7S.cjs.map
|
package/dist/chunk-3KEU5QYY.cjs
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkEGIZHYJP_cjs = require('./chunk-EGIZHYJP.cjs');
|
|
4
|
-
|
|
5
|
-
// src/compiler/traits/ProvenanceSemiring.ts
|
|
6
|
-
function createDeadElement(subsystem, elementId, reason, originalValue) {
|
|
7
|
-
return {
|
|
8
|
-
subsystem,
|
|
9
|
-
reason,
|
|
10
|
-
determinedAt: Date.now(),
|
|
11
|
-
elementId,
|
|
12
|
-
originalValue
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function authorityWeight(level, reputationScore) {
|
|
16
|
-
const clamped = Math.max(0, Math.min(100, level));
|
|
17
|
-
let baseWeight = 0.5 + clamped / 100 * 1.5;
|
|
18
|
-
if (reputationScore !== void 0 && reputationScore > 0) {
|
|
19
|
-
if (reputationScore >= 100) baseWeight *= 3;
|
|
20
|
-
else if (reputationScore >= 30) baseWeight *= 2;
|
|
21
|
-
else if (reputationScore >= 5) baseWeight *= 1.5;
|
|
22
|
-
}
|
|
23
|
-
return baseWeight;
|
|
24
|
-
}
|
|
25
|
-
var TRAIT_ZERO; exports.ProvenanceSemiring = void 0;
|
|
26
|
-
var init_ProvenanceSemiring = chunkEGIZHYJP_cjs.__esm({
|
|
27
|
-
"src/compiler/traits/ProvenanceSemiring.ts"() {
|
|
28
|
-
TRAIT_ZERO = /* @__PURE__ */ Symbol.for("HoloScript::TraitZero");
|
|
29
|
-
exports.ProvenanceSemiring = class {
|
|
30
|
-
constructor(rules) {
|
|
31
|
-
this.rules = /* @__PURE__ */ new Map();
|
|
32
|
-
if (rules) {
|
|
33
|
-
for (const rule of rules) {
|
|
34
|
-
this.rules.set(rule.property, rule);
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
this.loadDefaultRules();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
loadDefaultRules() {
|
|
41
|
-
this.rules.set("type", { property: "type", strategy: "domain-override", precedence: ["kinematic", "physics", "collidable", "static"] });
|
|
42
|
-
this.rules.set("mass", { property: "mass", strategy: "authority-weighted" });
|
|
43
|
-
this.rules.set("friction", { property: "friction", strategy: "max" });
|
|
44
|
-
this.rules.set("restitution", { property: "restitution", strategy: "min" });
|
|
45
|
-
this.rules.set("color", { property: "color", strategy: "domain-override", precedence: ["material", "color", "hoverable", "glowing"] });
|
|
46
|
-
this.rules.set("opacity", { property: "opacity", strategy: "min" });
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Commutative addition (⊕)
|
|
50
|
-
* Merges multiple traits into a unified provenanced configuration map.
|
|
51
|
-
*/
|
|
52
|
-
add(traits) {
|
|
53
|
-
const acc = {};
|
|
54
|
-
const conflicts = [];
|
|
55
|
-
const errors = [];
|
|
56
|
-
const deadElements = [];
|
|
57
|
-
for (const trait of traits) {
|
|
58
|
-
for (const [key, value] of Object.entries(trait.config)) {
|
|
59
|
-
if (value === TRAIT_ZERO) {
|
|
60
|
-
deadElements.push(createDeadElement(
|
|
61
|
-
"semiring",
|
|
62
|
-
`${trait.name}.${key}`,
|
|
63
|
-
`TRAIT_ZERO encountered during addition: property '${key}' from @${trait.name}`
|
|
64
|
-
));
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (!(key in acc)) {
|
|
68
|
-
acc[key] = { value, source: trait.name, context: trait.context };
|
|
69
|
-
} else {
|
|
70
|
-
const existing = acc[key];
|
|
71
|
-
try {
|
|
72
|
-
acc[key] = this.multiply(existing, { value, source: trait.name, context: trait.context }, key);
|
|
73
|
-
conflicts.push(`Resolved conflict on property '${key}' between @${existing.source} and @${trait.name}`);
|
|
74
|
-
} catch (err) {
|
|
75
|
-
errors.push(err instanceof Error ? err.message : String(err));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const finalConfig = {};
|
|
81
|
-
for (const [k, v] of Object.entries(acc)) {
|
|
82
|
-
finalConfig[k] = v.value;
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
config: finalConfig,
|
|
86
|
-
provenance: acc,
|
|
87
|
-
conflicts,
|
|
88
|
-
errors,
|
|
89
|
-
deadElements
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Semiring multiplication (⊗)
|
|
94
|
-
* Resolves conflicts based on loaded domain rules, enforcing commutativity.
|
|
95
|
-
*
|
|
96
|
-
* C1 FIX: Authority no longer bypasses rules. Instead, authority modulates
|
|
97
|
-
* the weight within rule resolution. Higher authority = higher weight in
|
|
98
|
-
* numeric strategies, tiebreaker in domain-override. This ensures the
|
|
99
|
-
* algebraic structure is preserved — crossing an authority threshold
|
|
100
|
-
* changes the WEIGHT of a resolution, not the MECHANISM.
|
|
101
|
-
*/
|
|
102
|
-
multiply(a, b, property) {
|
|
103
|
-
if (a.value === TRAIT_ZERO) return a;
|
|
104
|
-
if (b.value === TRAIT_ZERO) return b;
|
|
105
|
-
if (a.value === b.value) return a;
|
|
106
|
-
const rule = this.rules.get(property);
|
|
107
|
-
if (!rule) {
|
|
108
|
-
const authA = a.context?.authorityLevel ?? 0;
|
|
109
|
-
const authB = b.context?.authorityLevel ?? 0;
|
|
110
|
-
if (authA !== authB) {
|
|
111
|
-
return authA > authB ? a : b;
|
|
112
|
-
}
|
|
113
|
-
throw new Error(`Unresolved conflict on '${property}': @${a.source} (${a.value}) vs @${b.source} (${b.value})`);
|
|
114
|
-
}
|
|
115
|
-
const weightA = authorityWeight(a.context?.authorityLevel ?? 0, a.context?.reputationScore);
|
|
116
|
-
const weightB = authorityWeight(b.context?.authorityLevel ?? 0, b.context?.reputationScore);
|
|
117
|
-
switch (rule.strategy) {
|
|
118
|
-
case "max":
|
|
119
|
-
return {
|
|
120
|
-
value: Math.max(a.value, b.value),
|
|
121
|
-
source: a.value > b.value ? a.source : b.source
|
|
122
|
-
};
|
|
123
|
-
case "min":
|
|
124
|
-
return {
|
|
125
|
-
value: Math.min(a.value, b.value),
|
|
126
|
-
source: a.value < b.value ? a.source : b.source
|
|
127
|
-
};
|
|
128
|
-
case "sum":
|
|
129
|
-
return {
|
|
130
|
-
value: a.value + b.value,
|
|
131
|
-
source: `${a.source}+${b.source}`
|
|
132
|
-
};
|
|
133
|
-
case "multiply":
|
|
134
|
-
return {
|
|
135
|
-
value: a.value * b.value,
|
|
136
|
-
source: `${a.source}*${b.source}`
|
|
137
|
-
};
|
|
138
|
-
case "authority-weighted": {
|
|
139
|
-
const scaledA = a.value * weightA;
|
|
140
|
-
const scaledB = b.value * weightB;
|
|
141
|
-
return scaledA >= scaledB ? { value: a.value, source: a.source, context: a.context } : { value: b.value, source: b.source, context: b.context };
|
|
142
|
-
}
|
|
143
|
-
case "domain-override": {
|
|
144
|
-
const precedence = rule.precedence || [];
|
|
145
|
-
const aIndex = precedence.indexOf(a.source);
|
|
146
|
-
const bIndex = precedence.indexOf(b.source);
|
|
147
|
-
if (aIndex !== -1 && bIndex !== -1) {
|
|
148
|
-
if (aIndex === bIndex) {
|
|
149
|
-
return weightA >= weightB ? a : b;
|
|
150
|
-
}
|
|
151
|
-
return aIndex < bIndex ? a : b;
|
|
152
|
-
} else if (aIndex !== -1) {
|
|
153
|
-
return a;
|
|
154
|
-
} else if (bIndex !== -1) {
|
|
155
|
-
return b;
|
|
156
|
-
} else {
|
|
157
|
-
if (weightA !== weightB) {
|
|
158
|
-
return weightA > weightB ? a : b;
|
|
159
|
-
}
|
|
160
|
-
throw new Error(`Unresolved domain override on '${property}': @${a.source} vs @${b.source}`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
case "strict-error":
|
|
164
|
-
default:
|
|
165
|
-
throw new Error(`Composition conflict: @${a.source} and @${b.source} both supply '${property}' = ${a.value} vs ${b.value}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
exports.authorityWeight = authorityWeight;
|
|
173
|
-
exports.init_ProvenanceSemiring = init_ProvenanceSemiring;
|
|
174
|
-
//# sourceMappingURL=chunk-3KEU5QYY.cjs.map
|
|
175
|
-
//# sourceMappingURL=chunk-3KEU5QYY.cjs.map
|