hedgequantx 2.7.83 → 2.7.84
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
|
@@ -294,8 +294,14 @@ const getLoginUrl = async (provider) => {
|
|
|
294
294
|
if (!flag) return { success: false, url: null, childProcess: null, isHeadless: false, error: 'Provider not supported for OAuth' };
|
|
295
295
|
|
|
296
296
|
const headless = isHeadless();
|
|
297
|
+
const isGemini = (provider === 'google');
|
|
298
|
+
|
|
297
299
|
return new Promise((resolve) => {
|
|
298
|
-
|
|
300
|
+
// For Gemini: use 'pipe' stdin so we can send default project selection
|
|
301
|
+
const child = spawn(BINARY_PATH, [flag, '-no-browser'], {
|
|
302
|
+
cwd: INSTALL_DIR,
|
|
303
|
+
stdio: isGemini ? ['pipe', 'pipe', 'pipe'] : ['ignore', 'pipe', 'pipe']
|
|
304
|
+
});
|
|
299
305
|
let output = '', resolved = false;
|
|
300
306
|
|
|
301
307
|
const checkForUrl = () => {
|
|
@@ -303,14 +309,29 @@ const getLoginUrl = async (provider) => {
|
|
|
303
309
|
const urlMatch = output.match(/https?:\/\/[^\s]+/);
|
|
304
310
|
if (urlMatch) {
|
|
305
311
|
resolved = true;
|
|
306
|
-
resolve({ success: true, url: urlMatch[0], childProcess: child, isHeadless: headless, error: null });
|
|
312
|
+
resolve({ success: true, url: urlMatch[0], childProcess: child, isHeadless: headless, isGemini, error: null });
|
|
307
313
|
}
|
|
308
314
|
};
|
|
309
315
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
316
|
+
// For Gemini: auto-select default project when prompted
|
|
317
|
+
if (isGemini && child.stdout) {
|
|
318
|
+
child.stdout.on('data', (data) => {
|
|
319
|
+
output += data.toString();
|
|
320
|
+
checkForUrl();
|
|
321
|
+
// When Gemini asks for project selection, send Enter (default) or ALL
|
|
322
|
+
if (data.toString().includes('Enter project ID') && child.stdin) {
|
|
323
|
+
child.stdin.write('\n'); // Select default project
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
} else if (child.stdout) {
|
|
327
|
+
child.stdout.on('data', (data) => { output += data.toString(); checkForUrl(); });
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (child.stderr) {
|
|
331
|
+
child.stderr.on('data', (data) => { output += data.toString(); checkForUrl(); });
|
|
332
|
+
}
|
|
333
|
+
child.on('error', (err) => { if (!resolved) { resolved = true; resolve({ success: false, url: null, childProcess: null, isHeadless: headless, isGemini: false, error: err.message }); }});
|
|
334
|
+
child.on('close', (code) => { if (!resolved) { resolved = true; resolve({ success: false, url: null, childProcess: null, isHeadless: headless, isGemini: false, error: `Process exited with code ${code}` }); }});
|
|
314
335
|
});
|
|
315
336
|
};
|
|
316
337
|
|