hedgequantx 2.6.65 → 2.6.66
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 +27 -12
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -645,18 +645,21 @@ const selectProviderOption = async (provider) => {
|
|
|
645
645
|
|
|
646
646
|
/**
|
|
647
647
|
* Open URL in default browser
|
|
648
|
+
* @returns {Promise<boolean>} true if browser opened, false if failed
|
|
648
649
|
*/
|
|
649
650
|
const openBrowser = (url) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
651
|
+
return new Promise((resolve) => {
|
|
652
|
+
const { exec } = require('child_process');
|
|
653
|
+
const platform = process.platform;
|
|
654
|
+
|
|
655
|
+
let cmd;
|
|
656
|
+
if (platform === 'darwin') cmd = `open "${url}"`;
|
|
657
|
+
else if (platform === 'win32') cmd = `start "" "${url}"`;
|
|
658
|
+
else cmd = `xdg-open "${url}"`;
|
|
659
|
+
|
|
660
|
+
exec(cmd, (err) => {
|
|
661
|
+
resolve(!err);
|
|
662
|
+
});
|
|
660
663
|
});
|
|
661
664
|
};
|
|
662
665
|
|
|
@@ -748,14 +751,26 @@ const setupOAuthConnection = async (provider) => {
|
|
|
748
751
|
|
|
749
752
|
// Wait a moment then open browser
|
|
750
753
|
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
751
|
-
openBrowser(url);
|
|
754
|
+
const browserOpened = await openBrowser(url);
|
|
752
755
|
|
|
753
756
|
// Redraw with code input
|
|
754
757
|
console.clear();
|
|
755
758
|
displayBanner();
|
|
756
759
|
drawBoxHeaderContinue('CLAUDE PRO/MAX LOGIN', boxWidth);
|
|
757
760
|
|
|
758
|
-
|
|
761
|
+
if (browserOpened) {
|
|
762
|
+
console.log(makeLine(chalk.green('BROWSER OPENED')));
|
|
763
|
+
} else {
|
|
764
|
+
console.log(makeLine(chalk.yellow('COULD NOT OPEN BROWSER (VPS/SSH?)')));
|
|
765
|
+
console.log(makeLine(''));
|
|
766
|
+
console.log(makeLine(chalk.white('OPEN THIS URL IN YOUR BROWSER:')));
|
|
767
|
+
console.log(makeLine(''));
|
|
768
|
+
// Split URL into chunks that fit the box width
|
|
769
|
+
const maxUrlLen = W - 4;
|
|
770
|
+
for (let i = 0; i < url.length; i += maxUrlLen) {
|
|
771
|
+
console.log(makeLine(chalk.cyan(url.substring(i, i + maxUrlLen))));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
759
774
|
console.log(makeLine(''));
|
|
760
775
|
console.log(makeLine(chalk.white('AFTER LOGGING IN, YOU WILL SEE A CODE')));
|
|
761
776
|
console.log(makeLine(chalk.white('COPY THE ENTIRE CODE AND PASTE IT BELOW')));
|