hedgequantx 2.6.111 → 2.6.113
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
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -1042,12 +1042,19 @@ const setupProxyOAuth = async (provider, config) => {
|
|
|
1042
1042
|
console.log(chalk.gray(' (The page showing http://localhost:54545/callback?code=...)'));
|
|
1043
1043
|
console.log();
|
|
1044
1044
|
|
|
1045
|
-
|
|
1045
|
+
// Use inquirer directly for reliable input on VPS
|
|
1046
|
+
const inquirer = require('inquirer');
|
|
1047
|
+
const { callbackUrl } = await inquirer.prompt([{
|
|
1048
|
+
type: 'input',
|
|
1049
|
+
name: 'callbackUrl',
|
|
1050
|
+
message: 'Callback URL:',
|
|
1051
|
+
prefix: ' '
|
|
1052
|
+
}]);
|
|
1046
1053
|
|
|
1047
1054
|
if (callbackUrl && callbackUrl.trim()) {
|
|
1048
1055
|
const submitSpinner = ora({ text: 'Submitting callback...', color: 'cyan' }).start();
|
|
1049
1056
|
try {
|
|
1050
|
-
await proxyManager.submitCallback(callbackUrl.trim());
|
|
1057
|
+
await proxyManager.submitCallback(callbackUrl.trim(), provider.id);
|
|
1051
1058
|
submitSpinner.text = 'Verifying authorization...';
|
|
1052
1059
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1053
1060
|
await proxyManager.waitForAuth(authState, 10000, () => {});
|
|
@@ -532,11 +532,12 @@ const waitForAuth = async (state, timeoutMs = 300000, onStatus = () => {}) => {
|
|
|
532
532
|
|
|
533
533
|
/**
|
|
534
534
|
* Submit OAuth callback URL manually (for remote/VPS use)
|
|
535
|
-
* Extracts code and state from callback URL and submits to
|
|
535
|
+
* Extracts code and state from callback URL and submits to proxy via main port
|
|
536
536
|
* @param {string} callbackUrl - Full callback URL (http://localhost:54545/callback?code=xxx&state=yyy)
|
|
537
|
+
* @param {string} provider - Provider ID (anthropic, openai, gemini, qwen, iflow)
|
|
537
538
|
* @returns {Promise<boolean>}
|
|
538
539
|
*/
|
|
539
|
-
const submitCallback = async (callbackUrl) => {
|
|
540
|
+
const submitCallback = async (callbackUrl, provider = 'anthropic') => {
|
|
540
541
|
// Parse the callback URL
|
|
541
542
|
let url;
|
|
542
543
|
try {
|
|
@@ -552,13 +553,24 @@ const submitCallback = async (callbackUrl) => {
|
|
|
552
553
|
throw new Error('Missing code or state in callback URL');
|
|
553
554
|
}
|
|
554
555
|
|
|
555
|
-
//
|
|
556
|
+
// Map provider to callback endpoint
|
|
557
|
+
const callbackEndpoints = {
|
|
558
|
+
anthropic: '/anthropic/callback',
|
|
559
|
+
openai: '/codex/callback',
|
|
560
|
+
gemini: '/gemini/callback',
|
|
561
|
+
qwen: '/qwen/callback',
|
|
562
|
+
iflow: '/iflow/callback'
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
const endpoint = callbackEndpoints[provider] || '/anthropic/callback';
|
|
566
|
+
|
|
567
|
+
// Submit to proxy via main port (8317)
|
|
556
568
|
return new Promise((resolve, reject) => {
|
|
557
|
-
const callbackPath =
|
|
569
|
+
const callbackPath = `${endpoint}?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`;
|
|
558
570
|
|
|
559
571
|
const req = http.request({
|
|
560
572
|
hostname: '127.0.0.1',
|
|
561
|
-
port:
|
|
573
|
+
port: PROXY_PORT,
|
|
562
574
|
path: callbackPath,
|
|
563
575
|
method: 'GET',
|
|
564
576
|
timeout: 30000
|