simmer-automaton 0.3.0 → 0.3.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/dist/index.js +21 -0
- package/package.json +1 -1
- package/src/index.ts +22 -0
package/dist/index.js
CHANGED
|
@@ -68,6 +68,27 @@ async function refreshState(logger) {
|
|
|
68
68
|
if (cachedState.initialized) {
|
|
69
69
|
// Compute tier (totalPnl = 0 for now, will be enriched when P&L tracking is added)
|
|
70
70
|
currentTier = computeTier(cachedState, 0);
|
|
71
|
+
// Sync banditState from fetched skills — preserve memory for existing, seed new ones
|
|
72
|
+
const existingBySlug = new Map(banditState.map((s) => [s.slug, s]));
|
|
73
|
+
banditState = cachedSkills.map((skill) => {
|
|
74
|
+
const existing = existingBySlug.get(skill.id);
|
|
75
|
+
if (existing) {
|
|
76
|
+
// Preserve bandit memory, update enabled status
|
|
77
|
+
existing.enabled = skill.enabled !== false;
|
|
78
|
+
return existing;
|
|
79
|
+
}
|
|
80
|
+
// New skill — seed with zero history (unplayed gets priority)
|
|
81
|
+
return {
|
|
82
|
+
slug: skill.id,
|
|
83
|
+
enabled: skill.enabled !== false,
|
|
84
|
+
timesSelected: 0,
|
|
85
|
+
timesRewarded: 0,
|
|
86
|
+
totalPnl: 0,
|
|
87
|
+
consecutiveZeroSignals: 0,
|
|
88
|
+
signalsFoundTotal: 0,
|
|
89
|
+
tradesExecutedTotal: 0,
|
|
90
|
+
};
|
|
91
|
+
});
|
|
71
92
|
}
|
|
72
93
|
}
|
|
73
94
|
catch (e) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -83,6 +83,28 @@ async function refreshState(logger: { info: (m: string) => void; error: (m: stri
|
|
|
83
83
|
if (cachedState.initialized) {
|
|
84
84
|
// Compute tier (totalPnl = 0 for now, will be enriched when P&L tracking is added)
|
|
85
85
|
currentTier = computeTier(cachedState, 0);
|
|
86
|
+
|
|
87
|
+
// Sync banditState from fetched skills — preserve memory for existing, seed new ones
|
|
88
|
+
const existingBySlug = new Map(banditState.map((s) => [s.slug, s]));
|
|
89
|
+
banditState = cachedSkills.map((skill) => {
|
|
90
|
+
const existing = existingBySlug.get(skill.id);
|
|
91
|
+
if (existing) {
|
|
92
|
+
// Preserve bandit memory, update enabled status
|
|
93
|
+
existing.enabled = (skill as any).enabled !== false;
|
|
94
|
+
return existing;
|
|
95
|
+
}
|
|
96
|
+
// New skill — seed with zero history (unplayed gets priority)
|
|
97
|
+
return {
|
|
98
|
+
slug: skill.id,
|
|
99
|
+
enabled: (skill as any).enabled !== false,
|
|
100
|
+
timesSelected: 0,
|
|
101
|
+
timesRewarded: 0,
|
|
102
|
+
totalPnl: 0,
|
|
103
|
+
consecutiveZeroSignals: 0,
|
|
104
|
+
signalsFoundTotal: 0,
|
|
105
|
+
tradesExecutedTotal: 0,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
86
108
|
}
|
|
87
109
|
} catch (e) {
|
|
88
110
|
logger.error(`[simmer] Failed to refresh state: ${e}`);
|