@agent-e/core 1.2.0 → 1.2.1
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 +20 -15
- package/dist/index.js +27 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -102,6 +102,7 @@ var Observer = class {
|
|
|
102
102
|
const tradeEvents = [];
|
|
103
103
|
const roleChangeEvents = [];
|
|
104
104
|
let churnCount = 0;
|
|
105
|
+
let productionAmount = 0;
|
|
105
106
|
for (const e of recentEvents) {
|
|
106
107
|
switch (e.type) {
|
|
107
108
|
case "mint":
|
|
@@ -112,6 +113,9 @@ var Observer = class {
|
|
|
112
113
|
case "consume":
|
|
113
114
|
sinkVolume += e.amount ?? 0;
|
|
114
115
|
break;
|
|
116
|
+
case "produce":
|
|
117
|
+
productionAmount += e.amount ?? 1;
|
|
118
|
+
break;
|
|
115
119
|
case "trade":
|
|
116
120
|
tradeEvents.push(e);
|
|
117
121
|
break;
|
|
@@ -185,7 +189,7 @@ var Observer = class {
|
|
|
185
189
|
pinchPoints[resource] = "optimal";
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
|
-
const productionIndex =
|
|
192
|
+
const productionIndex = productionAmount;
|
|
189
193
|
const maxPossibleProduction = productionIndex + sinkVolume;
|
|
190
194
|
const capacityUsage = maxPossibleProduction > 0 ? productionIndex / maxPossibleProduction : 0;
|
|
191
195
|
const satisfactions = Object.values(state.agentSatisfaction ?? {});
|
|
@@ -883,7 +887,7 @@ var P12_OnePrimaryFaucet = {
|
|
|
883
887
|
id: "P12",
|
|
884
888
|
name: "One Primary Faucet",
|
|
885
889
|
category: "currency",
|
|
886
|
-
description: "Multiple independent currency sources (gathering +
|
|
890
|
+
description: "Multiple independent currency sources (gathering + production + quests) each creating currency causes uncontrolled inflation. One clear primary faucet makes the economy predictable and auditable.",
|
|
887
891
|
check(metrics, thresholds) {
|
|
888
892
|
const { netFlow, faucetVolume, sinkVolume } = metrics;
|
|
889
893
|
if (netFlow > thresholds.netFlowWarnThreshold) {
|
|
@@ -895,7 +899,7 @@ var P12_OnePrimaryFaucet = {
|
|
|
895
899
|
parameter: "productionCost",
|
|
896
900
|
direction: "increase",
|
|
897
901
|
magnitude: 0.15,
|
|
898
|
-
reasoning: `Net flow +${netFlow.toFixed(1)}
|
|
902
|
+
reasoning: `Net flow +${netFlow.toFixed(1)}/tick. Inflationary. Increase production cost (primary sink) to balance faucet output.`
|
|
899
903
|
},
|
|
900
904
|
confidence: 0.8,
|
|
901
905
|
estimatedLag: 8
|
|
@@ -910,7 +914,7 @@ var P12_OnePrimaryFaucet = {
|
|
|
910
914
|
parameter: "productionCost",
|
|
911
915
|
direction: "decrease",
|
|
912
916
|
magnitude: 0.15,
|
|
913
|
-
reasoning: `Net flow ${netFlow.toFixed(1)}
|
|
917
|
+
reasoning: `Net flow ${netFlow.toFixed(1)}/tick. Deflationary. Decrease production cost to ease sink pressure.`
|
|
914
918
|
},
|
|
915
919
|
confidence: 0.8,
|
|
916
920
|
estimatedLag: 8
|
|
@@ -969,7 +973,7 @@ var P14_TrackActualInjection = {
|
|
|
969
973
|
parameter: "yieldRate",
|
|
970
974
|
direction: "decrease",
|
|
971
975
|
magnitude: 0.1,
|
|
972
|
-
reasoning: `Supply growing at ${(supplyGrowthRate * 100).toFixed(1)}%/tick. Verify
|
|
976
|
+
reasoning: `Supply growing at ${(supplyGrowthRate * 100).toFixed(1)}%/tick. Verify currency injection tracking. Resources should not create currency directly.`
|
|
973
977
|
},
|
|
974
978
|
confidence: 0.55,
|
|
975
979
|
estimatedLag: 5
|
|
@@ -982,7 +986,7 @@ var P15_PoolsNeedCapAndDecay = {
|
|
|
982
986
|
id: "P15",
|
|
983
987
|
name: "Pools Need Cap + Decay",
|
|
984
988
|
category: "currency",
|
|
985
|
-
description: "Any pool (bank, reward pool) without a cap accumulates infinitely.
|
|
989
|
+
description: "Any pool (bank, reward pool) without a cap accumulates infinitely. A pool at 42% of total supply means 42% of the economy is frozen. Cap at 5%, decay at 2%/tick.",
|
|
986
990
|
check(metrics, thresholds) {
|
|
987
991
|
const { poolSizes, totalSupply } = metrics;
|
|
988
992
|
const { poolCapPercent } = thresholds;
|
|
@@ -997,7 +1001,7 @@ var P15_PoolsNeedCapAndDecay = {
|
|
|
997
1001
|
parameter: "transactionFee",
|
|
998
1002
|
direction: "decrease",
|
|
999
1003
|
magnitude: 0.1,
|
|
1000
|
-
reasoning: `${pool} pool at ${(shareOfSupply * 100).toFixed(1)}% of supply (cap: ${(poolCapPercent * 100).toFixed(0)}%).
|
|
1004
|
+
reasoning: `${pool} pool at ${(shareOfSupply * 100).toFixed(1)}% of supply (cap: ${(poolCapPercent * 100).toFixed(0)}%). Currency frozen. Lower fees to encourage circulation over accumulation.`
|
|
1001
1005
|
},
|
|
1002
1006
|
confidence: 0.85,
|
|
1003
1007
|
estimatedLag: 5
|
|
@@ -1139,25 +1143,22 @@ var P18_FirstProducerNeedsStartingInventory = {
|
|
|
1139
1143
|
description: "A producer with 0 resources and 0 currency must sell nothing to get currency before they can buy raw materials. This creates a chicken-and-egg freeze. Starting inventory (2 goods + 4 raw materials + 40 currency) breaks the deadlock.",
|
|
1140
1144
|
check(metrics, _thresholds) {
|
|
1141
1145
|
if (metrics.tick > 20) return { violated: false };
|
|
1146
|
+
const hasAgents = metrics.totalAgents > 0;
|
|
1142
1147
|
for (const [resource, supply] of Object.entries(metrics.supplyByResource)) {
|
|
1143
|
-
if (supply === 0) {
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
estimatedLag: 2
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1148
|
+
if (supply === 0 && hasAgents) {
|
|
1149
|
+
return {
|
|
1150
|
+
violated: true,
|
|
1151
|
+
severity: 8,
|
|
1152
|
+
evidence: { tick: metrics.tick, resource, supply, totalAgents: metrics.totalAgents },
|
|
1153
|
+
suggestedAction: {
|
|
1154
|
+
parameter: "productionCost",
|
|
1155
|
+
direction: "decrease",
|
|
1156
|
+
magnitude: 0.5,
|
|
1157
|
+
reasoning: `Bootstrap failure: ${resource} supply is 0 at tick ${metrics.tick} with ${metrics.totalAgents} agents. Drastically reduce production cost to allow immediate output.`
|
|
1158
|
+
},
|
|
1159
|
+
confidence: 0.9,
|
|
1160
|
+
estimatedLag: 2
|
|
1161
|
+
};
|
|
1161
1162
|
}
|
|
1162
1163
|
}
|
|
1163
1164
|
return { violated: false };
|
|
@@ -1798,7 +1799,7 @@ var P42_TheMedianPrinciple = {
|
|
|
1798
1799
|
parameter: "transactionFee",
|
|
1799
1800
|
direction: "increase",
|
|
1800
1801
|
magnitude: 0.15,
|
|
1801
|
-
reasoning: `Mean/median divergence ${(meanMedianDivergence * 100).toFixed(0)}% (threshold: ${(thresholds.meanMedianDivergenceMax * 100).toFixed(0)}%). Economy has outliers skewing metrics. Use median for decisions. Raise
|
|
1802
|
+
reasoning: `Mean/median divergence ${(meanMedianDivergence * 100).toFixed(0)}% (threshold: ${(thresholds.meanMedianDivergenceMax * 100).toFixed(0)}%). Economy has outliers skewing metrics. Use median for decisions. Raise transaction fees to redistribute wealth.`
|
|
1802
1803
|
},
|
|
1803
1804
|
confidence: 0.85,
|
|
1804
1805
|
estimatedLag: 15
|