hedgequantx 2.5.10 → 2.5.12
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 +30 -15
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -89,6 +89,11 @@ const aiAgentMenu = async () => {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
// Cache for scanned tokens (avoid multiple Keychain prompts)
|
|
93
|
+
let cachedTokens = null;
|
|
94
|
+
let cacheTimestamp = 0;
|
|
95
|
+
const CACHE_TTL = 60000; // 1 minute cache
|
|
96
|
+
|
|
92
97
|
/**
|
|
93
98
|
* Show existing tokens found on the system
|
|
94
99
|
*/
|
|
@@ -102,16 +107,26 @@ const showExistingTokens = async () => {
|
|
|
102
107
|
return chalk.cyan('║') + ' ' + content + ' '.repeat(Math.max(0, padding - 1)) + chalk.cyan('║');
|
|
103
108
|
};
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
console.log(makeLine(''));
|
|
109
|
-
console.log(makeLine(chalk.gray('CHECKING VS CODE, CURSOR, CLAUDE CLI, OPENCODE...')));
|
|
110
|
-
console.log(makeLine(''));
|
|
111
|
-
drawBoxFooter(boxWidth);
|
|
110
|
+
// Check cache first
|
|
111
|
+
const now = Date.now();
|
|
112
|
+
let tokens;
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
if (cachedTokens && (now - cacheTimestamp) < CACHE_TTL) {
|
|
115
|
+
tokens = cachedTokens;
|
|
116
|
+
} else {
|
|
117
|
+
console.clear();
|
|
118
|
+
displayBanner();
|
|
119
|
+
drawBoxHeaderContinue('SCANNING FOR EXISTING SESSIONS...', boxWidth);
|
|
120
|
+
console.log(makeLine(''));
|
|
121
|
+
console.log(makeLine(chalk.gray('CHECKING VS CODE, CURSOR, CLAUDE CLI, OPENCODE...')));
|
|
122
|
+
console.log(makeLine(''));
|
|
123
|
+
drawBoxFooter(boxWidth);
|
|
124
|
+
|
|
125
|
+
// Scan for tokens and cache
|
|
126
|
+
tokens = tokenScanner.scanAllSources();
|
|
127
|
+
cachedTokens = tokens;
|
|
128
|
+
cacheTimestamp = now;
|
|
129
|
+
}
|
|
115
130
|
|
|
116
131
|
if (tokens.length === 0) {
|
|
117
132
|
// No tokens found, go directly to category selection
|
|
@@ -121,7 +136,7 @@ const showExistingTokens = async () => {
|
|
|
121
136
|
// Show found tokens
|
|
122
137
|
console.clear();
|
|
123
138
|
displayBanner();
|
|
124
|
-
|
|
139
|
+
drawBoxHeaderContinue('EXISTING SESSIONS FOUND', boxWidth);
|
|
125
140
|
|
|
126
141
|
console.log(makeLine(chalk.green(`FOUND ${tokens.length} EXISTING SESSION(S)`)));
|
|
127
142
|
console.log(makeLine(''));
|
|
@@ -244,7 +259,7 @@ const selectCategory = async () => {
|
|
|
244
259
|
|
|
245
260
|
console.clear();
|
|
246
261
|
displayBanner();
|
|
247
|
-
|
|
262
|
+
drawBoxHeaderContinue('SELECT PROVIDER TYPE', boxWidth);
|
|
248
263
|
|
|
249
264
|
const categories = getCategories();
|
|
250
265
|
|
|
@@ -313,7 +328,7 @@ const selectProvider = async (categoryId) => {
|
|
|
313
328
|
|
|
314
329
|
const categories = getCategories();
|
|
315
330
|
const category = categories.find(c => c.id === categoryId);
|
|
316
|
-
|
|
331
|
+
drawBoxHeaderContinue(category.name, boxWidth);
|
|
317
332
|
|
|
318
333
|
const providers = getProvidersByCategory(categoryId);
|
|
319
334
|
|
|
@@ -399,7 +414,7 @@ const selectProviderOption = async (provider) => {
|
|
|
399
414
|
|
|
400
415
|
console.clear();
|
|
401
416
|
displayBanner();
|
|
402
|
-
|
|
417
|
+
drawBoxHeaderContinue(provider.name, boxWidth);
|
|
403
418
|
|
|
404
419
|
console.log(makeLine(chalk.white('SELECT CONNECTION METHOD:')));
|
|
405
420
|
console.log(makeLine(''));
|
|
@@ -547,7 +562,7 @@ const setupConnection = async (provider, option) => {
|
|
|
547
562
|
// Show instructions for this field
|
|
548
563
|
console.clear();
|
|
549
564
|
displayBanner();
|
|
550
|
-
|
|
565
|
+
drawBoxHeaderContinue(`CONNECT TO ${provider.name}`, boxWidth);
|
|
551
566
|
|
|
552
567
|
const instructions = getCredentialInstructions(provider, option, field);
|
|
553
568
|
|
|
@@ -664,7 +679,7 @@ const selectModel = async (provider) => {
|
|
|
664
679
|
|
|
665
680
|
console.clear();
|
|
666
681
|
displayBanner();
|
|
667
|
-
|
|
682
|
+
drawBoxHeaderContinue('SELECT MODEL', boxWidth);
|
|
668
683
|
|
|
669
684
|
const models = provider.models || [];
|
|
670
685
|
|