@apmantza/greedysearch-pi 1.4.0 → 1.4.1
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/README.md +208 -204
- package/cdp.mjs +16 -16
- package/extractors/bing-copilot.mjs +204 -204
- package/extractors/consent.mjs +248 -248
- package/extractors/google-ai.mjs +165 -165
- package/extractors/perplexity.mjs +184 -184
- package/extractors/selectors.mjs +52 -52
- package/index.ts +623 -623
- package/launch.mjs +33 -33
- package/package.json +2 -2
- package/search.mjs +997 -996
- package/skills/greedy-search/SKILL.md +145 -145
- package/test.sh +298 -298
- package/newfeaturesideas.md +0 -105
package/launch.mjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// the "Allow remote debugging?" dialog entirely. It runs on port 9222 so it doesn't
|
|
6
6
|
// conflict with your main Chrome session (which may use port 9223).
|
|
7
7
|
//
|
|
8
|
-
// search.mjs passes CDP_PROFILE_DIR so cdp.mjs targets this dedicated Chrome
|
|
9
|
-
// without ever touching the user's main Chrome DevToolsActivePort file.
|
|
8
|
+
// search.mjs passes CDP_PROFILE_DIR so cdp.mjs targets this dedicated Chrome
|
|
9
|
+
// without ever touching the user's main Chrome DevToolsActivePort file.
|
|
10
10
|
//
|
|
11
11
|
// Usage:
|
|
12
12
|
// node launch.mjs — launch (or report if already running)
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
// node launch.mjs --status — check if running
|
|
15
15
|
|
|
16
16
|
import { spawn } from 'child_process';
|
|
17
|
-
import { existsSync, writeFileSync, readFileSync, mkdirSync, unlinkSync } from 'fs';
|
|
18
|
-
import { tmpdir, platform } from 'os';
|
|
17
|
+
import { existsSync, writeFileSync, readFileSync, mkdirSync, unlinkSync } from 'fs';
|
|
18
|
+
import { tmpdir, platform } from 'os';
|
|
19
19
|
import { join } from 'path';
|
|
20
20
|
import http from 'http';
|
|
21
21
|
|
|
@@ -42,8 +42,8 @@ function findChrome() {
|
|
|
42
42
|
return candidates.find(existsSync) || null;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const CHROME_FLAGS = [
|
|
46
|
-
`--remote-debugging-port=${PORT}`,
|
|
45
|
+
const CHROME_FLAGS = [
|
|
46
|
+
`--remote-debugging-port=${PORT}`,
|
|
47
47
|
'--disable-features=DevToolsPrivacyUI', // suppresses "Allow remote debugging?" dialog
|
|
48
48
|
'--no-first-run',
|
|
49
49
|
'--no-default-browser-check',
|
|
@@ -97,21 +97,21 @@ async function writePortFile(timeoutMs = 15000) {
|
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
101
|
|
|
102
102
|
async function main() {
|
|
103
103
|
const arg = process.argv[2];
|
|
104
104
|
|
|
105
|
-
if (arg === '--kill') {
|
|
106
|
-
const pid = isRunning();
|
|
107
|
-
if (pid) {
|
|
108
|
-
try { process.kill(pid, 'SIGTERM'); console.log(`Stopped Chrome (pid ${pid}).`); }
|
|
109
|
-
catch (e) { console.error(`Failed: ${e.message}`); }
|
|
110
|
-
} else {
|
|
111
|
-
console.log('GreedySearch Chrome is not running.');
|
|
112
|
-
}
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
105
|
+
if (arg === '--kill') {
|
|
106
|
+
const pid = isRunning();
|
|
107
|
+
if (pid) {
|
|
108
|
+
try { process.kill(pid, 'SIGTERM'); console.log(`Stopped Chrome (pid ${pid}).`); }
|
|
109
|
+
catch (e) { console.error(`Failed: ${e.message}`); }
|
|
110
|
+
} else {
|
|
111
|
+
console.log('GreedySearch Chrome is not running.');
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
115
|
|
|
116
116
|
if (arg === '--status') {
|
|
117
117
|
const pid = isRunning();
|
|
@@ -123,12 +123,12 @@ async function main() {
|
|
|
123
123
|
// Already running?
|
|
124
124
|
const existing = isRunning();
|
|
125
125
|
if (existing) {
|
|
126
|
-
const ready = await writePortFile(5000);
|
|
127
|
-
if (ready) {
|
|
128
|
-
console.log(`GreedySearch Chrome already running (pid ${existing}, port ${PORT}).`);
|
|
129
|
-
console.log('Dedicated GreedySearch DevToolsActivePort is ready.');
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
126
|
+
const ready = await writePortFile(5000);
|
|
127
|
+
if (ready) {
|
|
128
|
+
console.log(`GreedySearch Chrome already running (pid ${existing}, port ${PORT}).`);
|
|
129
|
+
console.log('Dedicated GreedySearch DevToolsActivePort is ready.');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
132
|
// Stale PID — process alive but not Chrome on port 9223. Fall through to fresh launch.
|
|
133
133
|
console.log(`Stale PID ${existing} detected (not Chrome on port ${PORT}) — launching fresh.`);
|
|
134
134
|
try { unlinkSync(PID_FILE); } catch {}
|
|
@@ -152,15 +152,15 @@ async function main() {
|
|
|
152
152
|
proc.unref();
|
|
153
153
|
writeFileSync(PID_FILE, String(proc.pid));
|
|
154
154
|
|
|
155
|
-
// Wait for Chrome HTTP endpoint and build the dedicated DevToolsActivePort file
|
|
156
|
-
const portFileReady = await writePortFile();
|
|
157
|
-
if (!portFileReady) {
|
|
158
|
-
console.error('Chrome did not become ready within 15s.');
|
|
159
|
-
process.exit(1);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
console.log(`Ready. No more "Allow remote debugging?" dialogs.`);
|
|
163
|
-
console.log('GreedySearch now uses its own isolated DevToolsActivePort file.');
|
|
164
|
-
}
|
|
155
|
+
// Wait for Chrome HTTP endpoint and build the dedicated DevToolsActivePort file
|
|
156
|
+
const portFileReady = await writePortFile();
|
|
157
|
+
if (!portFileReady) {
|
|
158
|
+
console.error('Chrome did not become ready within 15s.');
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
console.log(`Ready. No more "Allow remote debugging?" dialogs.`);
|
|
163
|
+
console.log('GreedySearch now uses its own isolated DevToolsActivePort file.');
|
|
164
|
+
}
|
|
165
165
|
|
|
166
166
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apmantza/greedysearch-pi",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Pi extension: browser-automation tool that searches Perplexity, Bing Copilot, and Google AI in parallel, extracts answers and sources via CDP, with optional Gemini synthesis — grounded AI answers from real browser interactions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/apmantza/GreedySearch-pi"
|
|
11
|
+
"url": "git+https://github.com/apmantza/GreedySearch-pi.git"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"pi": {
|