hedgequantx 2.6.109 → 2.6.111
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 +38 -40
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -1029,53 +1029,51 @@ const setupProxyOAuth = async (provider, config) => {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
console.log();
|
|
1031
1031
|
|
|
1032
|
-
// Step 4: Wait for OAuth callback
|
|
1033
|
-
|
|
1032
|
+
// Step 4: Wait for OAuth callback
|
|
1033
|
+
// Detect if we're on a remote server (SSH) - callback won't work automatically
|
|
1034
|
+
const isRemote = process.env.SSH_CONNECTION || process.env.SSH_CLIENT ||
|
|
1035
|
+
(process.env.DISPLAY === undefined && process.platform === 'linux');
|
|
1034
1036
|
|
|
1035
1037
|
let authSuccess = false;
|
|
1036
1038
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
const submitSpinner = ora({ text: 'Submitting callback...', color: 'cyan' }).start();
|
|
1057
|
-
try {
|
|
1058
|
-
await proxyManager.submitCallback(callbackUrl.trim());
|
|
1059
|
-
submitSpinner.text = 'Verifying authorization...';
|
|
1060
|
-
|
|
1061
|
-
// Wait a bit for the proxy to process the callback
|
|
1062
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
1063
|
-
|
|
1064
|
-
// Verify auth status
|
|
1065
|
-
await proxyManager.waitForAuth(authState, 10000, () => {});
|
|
1066
|
-
authSuccess = true;
|
|
1067
|
-
submitSpinner.succeed('Authorization successful!');
|
|
1068
|
-
} catch (submitError) {
|
|
1069
|
-
submitSpinner.fail(`Failed: ${submitError.message}`);
|
|
1070
|
-
await prompts.waitForEnter();
|
|
1071
|
-
return await selectProviderOption(provider);
|
|
1072
|
-
}
|
|
1073
|
-
} else {
|
|
1074
|
-
console.log(chalk.gray(' Cancelled.'));
|
|
1039
|
+
if (isRemote) {
|
|
1040
|
+
// Remote/VPS: Ask for callback URL directly (no point waiting)
|
|
1041
|
+
console.log(chalk.yellow(' After authorizing, paste the callback URL from your browser:'));
|
|
1042
|
+
console.log(chalk.gray(' (The page showing http://localhost:54545/callback?code=...)'));
|
|
1043
|
+
console.log();
|
|
1044
|
+
|
|
1045
|
+
const callbackUrl = await prompts.textInput(' Callback URL: ');
|
|
1046
|
+
|
|
1047
|
+
if (callbackUrl && callbackUrl.trim()) {
|
|
1048
|
+
const submitSpinner = ora({ text: 'Submitting callback...', color: 'cyan' }).start();
|
|
1049
|
+
try {
|
|
1050
|
+
await proxyManager.submitCallback(callbackUrl.trim());
|
|
1051
|
+
submitSpinner.text = 'Verifying authorization...';
|
|
1052
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1053
|
+
await proxyManager.waitForAuth(authState, 10000, () => {});
|
|
1054
|
+
authSuccess = true;
|
|
1055
|
+
submitSpinner.succeed('Authorization successful!');
|
|
1056
|
+
} catch (submitError) {
|
|
1057
|
+
submitSpinner.fail(`Failed: ${submitError.message}`);
|
|
1075
1058
|
await prompts.waitForEnter();
|
|
1076
1059
|
return await selectProviderOption(provider);
|
|
1077
1060
|
}
|
|
1078
1061
|
} else {
|
|
1062
|
+
console.log(chalk.gray(' Cancelled.'));
|
|
1063
|
+
await prompts.waitForEnter();
|
|
1064
|
+
return await selectProviderOption(provider);
|
|
1065
|
+
}
|
|
1066
|
+
} else {
|
|
1067
|
+
// Local: Wait for automatic callback
|
|
1068
|
+
const waitSpinner = ora({ text: 'Waiting for authorization...', color: 'cyan' }).start();
|
|
1069
|
+
|
|
1070
|
+
try {
|
|
1071
|
+
await proxyManager.waitForAuth(authState, 300000, (status) => {
|
|
1072
|
+
waitSpinner.text = status;
|
|
1073
|
+
});
|
|
1074
|
+
authSuccess = true;
|
|
1075
|
+
waitSpinner.succeed('Authorization successful!');
|
|
1076
|
+
} catch (error) {
|
|
1079
1077
|
waitSpinner.fail(`Authorization failed: ${error.message}`);
|
|
1080
1078
|
await prompts.waitForEnter();
|
|
1081
1079
|
return await selectProviderOption(provider);
|