@apmantza/greedysearch-pi 1.8.9 → 1.9.0
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/CHANGELOG.md +503 -446
- package/bin/cdp.mjs +15 -2
- package/bin/search.mjs +679 -668
- package/extractors/bing-copilot.mjs +68 -11
- package/extractors/common.mjs +37 -2
- package/extractors/consent.mjs +388 -294
- package/extractors/gemini.mjs +217 -150
- package/extractors/perplexity.mjs +56 -7
- package/package.json +1 -1
- package/src/search/chrome.mjs +62 -1
- package/src/search/constants.mjs +1 -6
- package/src/search/engines.mjs +76 -67
- package/src/search/file-sources.mjs +46 -0
- package/src/search/query.mjs +49 -0
- package/src/search/recovery.mjs +20 -1
- package/src/search/sources.mjs +37 -21
- package/src/search/synthesis.mjs +27 -16
- package/extractors/bing-aria.mjs +0 -539
- package/extractors/google-search.mjs +0 -234
package/bin/cdp.mjs
CHANGED
|
@@ -365,10 +365,23 @@ async function captureMainContext(cdp, sid) {
|
|
|
365
365
|
// Always disable Runtime after capturing
|
|
366
366
|
await cdp.send("Runtime.disable", {}, sid).catch(() => {});
|
|
367
367
|
|
|
368
|
-
//
|
|
369
|
-
|
|
368
|
+
// Get the root frame ID so we can prefer its context when multiple
|
|
369
|
+
// isDefault contexts exist (e.g. Gemini embeds _/bscframe as a child
|
|
370
|
+
// frame whose context fires first and would otherwise be picked instead).
|
|
371
|
+
let rootFrameId = null;
|
|
372
|
+
try {
|
|
373
|
+
const ft = await cdp.send("Page.getFrameTree", {}, sid);
|
|
374
|
+
rootFrameId = ft?.frameTree?.frame?.id ?? null;
|
|
375
|
+
} catch {}
|
|
376
|
+
|
|
377
|
+
const defaults = contexts.filter(
|
|
370
378
|
(ctx) => ctx.auxData?.isDefault && ctx.auxData?.type === "default",
|
|
371
379
|
);
|
|
380
|
+
// Prefer the context whose frameId matches the root frame
|
|
381
|
+
const main =
|
|
382
|
+
(rootFrameId && defaults.find((ctx) => ctx.auxData?.frameId === rootFrameId)) ||
|
|
383
|
+
defaults[0] ||
|
|
384
|
+
null;
|
|
372
385
|
return main?.id ?? null;
|
|
373
386
|
}
|
|
374
387
|
|