hedgequantx 2.6.0 → 2.6.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/package.json +1 -1
- package/src/services/session.js +27 -5
package/package.json
CHANGED
package/src/services/session.js
CHANGED
|
@@ -141,9 +141,15 @@ const connections = {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* Saves all sessions to encrypted storage
|
|
144
|
+
* IMPORTANT: Preserves AI agent sessions when saving trading connections
|
|
144
145
|
*/
|
|
145
146
|
saveToStorage() {
|
|
146
|
-
|
|
147
|
+
// Load existing sessions to preserve AI settings
|
|
148
|
+
const existingSessions = storage.load();
|
|
149
|
+
const aiSession = existingSessions.find(s => s.type === 'ai');
|
|
150
|
+
|
|
151
|
+
// Build trading sessions
|
|
152
|
+
const tradingSessions = this.services.map(conn => {
|
|
147
153
|
const session = {
|
|
148
154
|
type: conn.type,
|
|
149
155
|
propfirm: conn.propfirm,
|
|
@@ -163,7 +169,12 @@ const connections = {
|
|
|
163
169
|
return session;
|
|
164
170
|
});
|
|
165
171
|
|
|
166
|
-
|
|
172
|
+
// Combine: trading sessions + preserved AI session
|
|
173
|
+
const allSessions = aiSession
|
|
174
|
+
? [...tradingSessions, aiSession]
|
|
175
|
+
: tradingSessions;
|
|
176
|
+
|
|
177
|
+
storage.save(allSessions);
|
|
167
178
|
},
|
|
168
179
|
|
|
169
180
|
/**
|
|
@@ -360,9 +371,13 @@ const connections = {
|
|
|
360
371
|
},
|
|
361
372
|
|
|
362
373
|
/**
|
|
363
|
-
* Disconnects all connections
|
|
374
|
+
* Disconnects all trading connections (preserves AI agents)
|
|
364
375
|
*/
|
|
365
376
|
disconnectAll() {
|
|
377
|
+
// Preserve AI session before clearing
|
|
378
|
+
const existingSessions = storage.load();
|
|
379
|
+
const aiSession = existingSessions.find(s => s.type === 'ai');
|
|
380
|
+
|
|
366
381
|
for (const conn of this.services) {
|
|
367
382
|
try {
|
|
368
383
|
if (conn.service?.logout) {
|
|
@@ -381,8 +396,15 @@ const connections = {
|
|
|
381
396
|
}
|
|
382
397
|
|
|
383
398
|
this.services = [];
|
|
384
|
-
|
|
385
|
-
|
|
399
|
+
|
|
400
|
+
// Save with preserved AI session (don't use storage.clear())
|
|
401
|
+
if (aiSession) {
|
|
402
|
+
storage.save([aiSession]);
|
|
403
|
+
log.info('Trading connections disconnected (AI agents preserved)');
|
|
404
|
+
} else {
|
|
405
|
+
storage.clear();
|
|
406
|
+
log.info('All connections disconnected');
|
|
407
|
+
}
|
|
386
408
|
},
|
|
387
409
|
|
|
388
410
|
/**
|