hedgequantx 2.5.11 → 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 +24 -9
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
|