@agent-e/core 1.6.7 → 1.6.8
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -250,6 +250,8 @@ var Observer = class {
|
|
|
250
250
|
const uniqueRoles = new Set(Object.values(state.agentRoles));
|
|
251
251
|
const rolesEmpty = uniqueRoles.size <= 1;
|
|
252
252
|
if (rolesEmpty && personaDistribution && Object.keys(personaDistribution).length > 0) {
|
|
253
|
+
for (const key of Object.keys(populationByRole)) delete populationByRole[key];
|
|
254
|
+
for (const key of Object.keys(roleShares)) delete roleShares[key];
|
|
253
255
|
for (const [persona, fraction] of Object.entries(personaDistribution)) {
|
|
254
256
|
populationByRole[persona] = Math.round(fraction * totalAgents);
|
|
255
257
|
}
|
|
@@ -752,24 +754,29 @@ var P4_MaterialsFlowFasterThanCooldown = {
|
|
|
752
754
|
const roleEntries = Object.entries(populationByRole);
|
|
753
755
|
const totalRoles = roleEntries.length;
|
|
754
756
|
if (totalRoles >= 2 && avgSupplyPerAgent < 0.5) {
|
|
757
|
+
const stagnantCurrencies = [];
|
|
755
758
|
for (const [currency, currVelocity] of Object.entries(velocityByCurrency)) {
|
|
756
759
|
if (currVelocity < 5) {
|
|
757
|
-
|
|
758
|
-
violated: true,
|
|
759
|
-
severity: 5,
|
|
760
|
-
evidence: { currency, currVelocity, avgSupplyPerAgent, totalRoles },
|
|
761
|
-
suggestedAction: {
|
|
762
|
-
parameterType: "yield",
|
|
763
|
-
scope: { currency },
|
|
764
|
-
direction: "increase",
|
|
765
|
-
magnitude: 0.15,
|
|
766
|
-
reasoning: `${currency} velocity is ${currVelocity.toFixed(1)} \u2014 materials not flowing. Increase yield to compensate.`
|
|
767
|
-
},
|
|
768
|
-
confidence: 0.7,
|
|
769
|
-
estimatedLag: 8
|
|
770
|
-
};
|
|
760
|
+
stagnantCurrencies.push({ currency, currVelocity });
|
|
771
761
|
}
|
|
772
762
|
}
|
|
763
|
+
if (stagnantCurrencies.length > 0) {
|
|
764
|
+
const worst = stagnantCurrencies.reduce((a, b) => a.currVelocity < b.currVelocity ? a : b);
|
|
765
|
+
return {
|
|
766
|
+
violated: true,
|
|
767
|
+
severity: 5,
|
|
768
|
+
evidence: { stagnantCurrencies, worst: worst.currency, avgSupplyPerAgent, totalRoles },
|
|
769
|
+
suggestedAction: {
|
|
770
|
+
parameterType: "yield",
|
|
771
|
+
scope: { currency: worst.currency },
|
|
772
|
+
direction: "increase",
|
|
773
|
+
magnitude: 0.15,
|
|
774
|
+
reasoning: `${stagnantCurrencies.length} currencies stagnant (worst: ${worst.currency} at ${worst.currVelocity.toFixed(1)}). Increase yield to compensate.`
|
|
775
|
+
},
|
|
776
|
+
confidence: 0.7,
|
|
777
|
+
estimatedLag: 8
|
|
778
|
+
};
|
|
779
|
+
}
|
|
773
780
|
if (Object.keys(velocityByCurrency).length === 0 && velocity < 5) {
|
|
774
781
|
return {
|
|
775
782
|
violated: true,
|
|
@@ -952,18 +959,7 @@ var P8_RegulatorCannotFightDesign = {
|
|
|
952
959
|
if (dominantShare <= 0.3) return { violated: false };
|
|
953
960
|
const isStructural = thresholds.dominantRoles?.includes(dominantRole) ?? false;
|
|
954
961
|
if (isStructural) {
|
|
955
|
-
return {
|
|
956
|
-
violated: true,
|
|
957
|
-
severity: 3,
|
|
958
|
-
evidence: { role: dominantRole, share: dominantShare, classification: "structural" },
|
|
959
|
-
suggestedAction: {
|
|
960
|
-
parameterType: "rate",
|
|
961
|
-
direction: "set",
|
|
962
|
-
magnitude: 0,
|
|
963
|
-
reasoning: `${dominantRole} dominance (${(dominantShare * 100).toFixed(0)}%) is by design. No intervention.`
|
|
964
|
-
},
|
|
965
|
-
confidence: 0.85
|
|
966
|
-
};
|
|
962
|
+
return { violated: false };
|
|
967
963
|
}
|
|
968
964
|
return {
|
|
969
965
|
violated: true,
|
|
@@ -1736,37 +1732,6 @@ var P27_AdjustmentsNeedCooldowns = {
|
|
|
1736
1732
|
return { violated: false };
|
|
1737
1733
|
}
|
|
1738
1734
|
};
|
|
1739
|
-
var P28_StructuralDominanceIsNotPathological = {
|
|
1740
|
-
id: "P28",
|
|
1741
|
-
name: "Structural Dominance \u2260 Pathological Monopoly",
|
|
1742
|
-
category: "regulator",
|
|
1743
|
-
description: 'A designed dominant role (majority exceeds 55%) should not trigger population suppression. AgentE must distinguish between "this role is dominant BY DESIGN" (configured via dominantRoles) and "this role took over unexpectedly".',
|
|
1744
|
-
check(metrics, _thresholds) {
|
|
1745
|
-
const { roleShares, avgSatisfaction } = metrics;
|
|
1746
|
-
const dominant = Object.entries(roleShares).sort((a, b) => b[1] - a[1])[0];
|
|
1747
|
-
if (!dominant) return { violated: false };
|
|
1748
|
-
const [dominantRole, dominantShare] = dominant;
|
|
1749
|
-
if (dominantShare > 0.4 && avgSatisfaction > 70) {
|
|
1750
|
-
return { violated: false };
|
|
1751
|
-
}
|
|
1752
|
-
if (dominantShare > 0.4 && avgSatisfaction < 50) {
|
|
1753
|
-
return {
|
|
1754
|
-
violated: true,
|
|
1755
|
-
severity: 5,
|
|
1756
|
-
evidence: { dominantRole, dominantShare, avgSatisfaction },
|
|
1757
|
-
suggestedAction: {
|
|
1758
|
-
parameterType: "cost",
|
|
1759
|
-
direction: "decrease",
|
|
1760
|
-
magnitude: 0.1,
|
|
1761
|
-
reasoning: `${dominantRole} dominant (${(dominantShare * 100).toFixed(0)}%) with low satisfaction. Pathological dominance \u2014 agents trapped, not thriving. Ease costs to allow role switching.`
|
|
1762
|
-
},
|
|
1763
|
-
confidence: 0.65,
|
|
1764
|
-
estimatedLag: 15
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
return { violated: false };
|
|
1768
|
-
}
|
|
1769
|
-
};
|
|
1770
1735
|
var P38_CommunicationPreventsRevolt = {
|
|
1771
1736
|
id: "P38",
|
|
1772
1737
|
name: "Communication Prevents Revolt",
|
|
@@ -4523,7 +4488,7 @@ export {
|
|
|
4523
4488
|
P25_CorrectLeversForCorrectProblems,
|
|
4524
4489
|
P26_ContinuousPressureBeatsThresholdCuts,
|
|
4525
4490
|
P27_AdjustmentsNeedCooldowns,
|
|
4526
|
-
P28_StructuralDominanceIsNotPathological,
|
|
4491
|
+
P8_RegulatorCannotFightDesign as P28_StructuralDominanceIsNotPathological,
|
|
4527
4492
|
P29_BottleneckDetection,
|
|
4528
4493
|
P2_ClosedLoopsNeedDirectHandoff,
|
|
4529
4494
|
P30_DynamicBottleneckRotation,
|