hedgequantx 2.6.0 → 2.6.2
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/menus/ai-agent.js +15 -7
- package/src/services/session.js +27 -5
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -219,11 +219,13 @@ const showAgentDetails = async (agent) => {
|
|
|
219
219
|
|
|
220
220
|
const choice = await prompts.textInput(chalk.cyan('SELECT:'));
|
|
221
221
|
|
|
222
|
+
const agentDisplayName = agent.model ? `${agent.name} (${agent.model})` : agent.name;
|
|
223
|
+
|
|
222
224
|
switch ((choice || '').toLowerCase()) {
|
|
223
225
|
case 'a':
|
|
224
226
|
if (!agent.isActive) {
|
|
225
227
|
aiService.setActiveAgent(agent.id);
|
|
226
|
-
console.log(chalk.green(`\n ${
|
|
228
|
+
console.log(chalk.green(`\n ${agentDisplayName} IS NOW ACTIVE`));
|
|
227
229
|
await prompts.waitForEnter();
|
|
228
230
|
}
|
|
229
231
|
return await aiAgentMenu();
|
|
@@ -231,7 +233,7 @@ const showAgentDetails = async (agent) => {
|
|
|
231
233
|
return await selectModel(agent);
|
|
232
234
|
case 'r':
|
|
233
235
|
aiService.removeAgent(agent.id);
|
|
234
|
-
console.log(chalk.yellow(`\n ${
|
|
236
|
+
console.log(chalk.yellow(`\n ${agentDisplayName} REMOVED`));
|
|
235
237
|
await prompts.waitForEnter();
|
|
236
238
|
return await aiAgentMenu();
|
|
237
239
|
case '<':
|
|
@@ -267,8 +269,9 @@ const selectActiveAgent = async () => {
|
|
|
267
269
|
const providerColor = agent.providerId === 'anthropic' ? chalk.magenta :
|
|
268
270
|
agent.providerId === 'openai' ? chalk.green : chalk.cyan;
|
|
269
271
|
|
|
272
|
+
const modelDisplay = agent.model ? chalk.gray(` (${agent.model})`) : '';
|
|
270
273
|
console.log(makeLine(
|
|
271
|
-
chalk.white(`[${i + 1}] `) + providerColor(agent.name) + activeMarker
|
|
274
|
+
chalk.white(`[${i + 1}] `) + providerColor(agent.name) + modelDisplay + activeMarker
|
|
272
275
|
));
|
|
273
276
|
}
|
|
274
277
|
|
|
@@ -289,7 +292,9 @@ const selectActiveAgent = async () => {
|
|
|
289
292
|
}
|
|
290
293
|
|
|
291
294
|
aiService.setActiveAgent(agents[index].id);
|
|
292
|
-
|
|
295
|
+
const selectedAgent = agents[index];
|
|
296
|
+
const modelInfo = selectedAgent.model ? ` (${selectedAgent.model})` : '';
|
|
297
|
+
console.log(chalk.green(`\n ${selectedAgent.name}${modelInfo} IS NOW ACTIVE`));
|
|
293
298
|
await prompts.waitForEnter();
|
|
294
299
|
return await aiAgentMenu();
|
|
295
300
|
};
|
|
@@ -371,8 +376,9 @@ const selectAgentToRemove = async () => {
|
|
|
371
376
|
|
|
372
377
|
for (let i = 0; i < agents.length; i++) {
|
|
373
378
|
const agent = agents[i];
|
|
379
|
+
const modelDisplay = agent.model ? chalk.gray(` (${agent.model})`) : '';
|
|
374
380
|
console.log(makeLine(
|
|
375
|
-
chalk.white(`[${i + 1}] `) + chalk.red(agent.name)
|
|
381
|
+
chalk.white(`[${i + 1}] `) + chalk.red(agent.name) + modelDisplay
|
|
376
382
|
));
|
|
377
383
|
}
|
|
378
384
|
|
|
@@ -392,8 +398,10 @@ const selectAgentToRemove = async () => {
|
|
|
392
398
|
return await aiAgentMenu();
|
|
393
399
|
}
|
|
394
400
|
|
|
395
|
-
|
|
396
|
-
|
|
401
|
+
const removedAgent = agents[index];
|
|
402
|
+
const modelInfo = removedAgent.model ? ` (${removedAgent.model})` : '';
|
|
403
|
+
aiService.removeAgent(removedAgent.id);
|
|
404
|
+
console.log(chalk.yellow(`\n ${removedAgent.name}${modelInfo} REMOVED`));
|
|
397
405
|
await prompts.waitForEnter();
|
|
398
406
|
return await aiAgentMenu();
|
|
399
407
|
};
|
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
|
/**
|