hedgequantx 2.5.12 → 2.5.14
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/app.js +9 -3
- package/src/menus/ai-agent.js +297 -50
- package/src/menus/dashboard.js +9 -13
- package/src/pages/algo/index.js +230 -35
- package/src/services/ai/index.js +304 -61
- package/src/services/ai/supervisor.js +713 -0
- package/src/services/ai/token-scanner.js +27 -4
|
@@ -381,7 +381,8 @@ const PROVIDER_PATTERNS = {
|
|
|
381
381
|
displayName: 'CLAUDE (ANTHROPIC)',
|
|
382
382
|
keyPatterns: [
|
|
383
383
|
/sk-ant-api\d{2}-[a-zA-Z0-9_-]{80,}/g, // New format API key
|
|
384
|
-
/sk-ant-[a-zA-Z0-9_-]{40,}/g,
|
|
384
|
+
/sk-ant-oat\d{2}-[a-zA-Z0-9_-]{40,}/g, // OAuth access token (from Claude Max/Pro subscription)
|
|
385
|
+
/sk-ant-(?!ort)[a-zA-Z0-9_-]{40,}/g, // Old format API key (excludes refresh tokens: sk-ant-ort...)
|
|
385
386
|
],
|
|
386
387
|
sessionPatterns: [
|
|
387
388
|
/"sessionKey"\s*:\s*"([^"]+)"/gi,
|
|
@@ -657,14 +658,32 @@ const parseCredentialJson = (output, entry) => {
|
|
|
657
658
|
|
|
658
659
|
/**
|
|
659
660
|
* Read tokens from macOS Keychain
|
|
661
|
+
* Optimized: stops after finding first valid token per provider to minimize password prompts
|
|
660
662
|
*/
|
|
661
663
|
const readMacOSKeychain = () => {
|
|
662
664
|
if (platform !== 'darwin') return [];
|
|
663
665
|
|
|
664
666
|
const results = [];
|
|
665
667
|
const { execSync } = require('child_process');
|
|
668
|
+
const foundProviders = new Set(); // Track which providers we already found
|
|
669
|
+
|
|
670
|
+
// Sort entries to prioritize most common ones first
|
|
671
|
+
const priorityOrder = ['Claude Code-credentials', 'Cursor-credentials', 'Claude Safe Storage'];
|
|
672
|
+
const sortedEntries = [...CREDENTIAL_ENTRIES].sort((a, b) => {
|
|
673
|
+
const aIdx = priorityOrder.indexOf(a.service);
|
|
674
|
+
const bIdx = priorityOrder.indexOf(b.service);
|
|
675
|
+
if (aIdx === -1 && bIdx === -1) return 0;
|
|
676
|
+
if (aIdx === -1) return 1;
|
|
677
|
+
if (bIdx === -1) return -1;
|
|
678
|
+
return aIdx - bIdx;
|
|
679
|
+
});
|
|
666
680
|
|
|
667
|
-
for (const entry of
|
|
681
|
+
for (const entry of sortedEntries) {
|
|
682
|
+
// Skip if we already found a token for this provider
|
|
683
|
+
if (foundProviders.has(entry.provider)) {
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
|
|
668
687
|
try {
|
|
669
688
|
const output = execSync(
|
|
670
689
|
`security find-generic-password -s "${entry.service}" -w 2>/dev/null`,
|
|
@@ -672,10 +691,14 @@ const readMacOSKeychain = () => {
|
|
|
672
691
|
).trim();
|
|
673
692
|
|
|
674
693
|
if (output) {
|
|
675
|
-
|
|
694
|
+
const tokens = parseCredentialJson(output, entry);
|
|
695
|
+
if (tokens.length > 0) {
|
|
696
|
+
results.push(...tokens);
|
|
697
|
+
foundProviders.add(entry.provider); // Mark this provider as found
|
|
698
|
+
}
|
|
676
699
|
}
|
|
677
700
|
} catch {
|
|
678
|
-
// Entry not found or access denied
|
|
701
|
+
// Entry not found or access denied - no password prompt for missing entries
|
|
679
702
|
}
|
|
680
703
|
}
|
|
681
704
|
|