@apmantza/greedysearch-pi 1.1.2 → 1.1.4

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 CHANGED
@@ -1,70 +1,169 @@
1
- # GreedySearch for Pi
2
-
3
- Pi extension that adds a `greedy_search` tool — fans out queries to Perplexity, Bing Copilot, and Google AI simultaneously and returns synthesized AI answers. Gemini can act as an optional synthesizer via `synthesize: true`, deduplicating sources across engines and returning a single grounded answer.
4
-
5
- Forked from [GreedySearch-claude](https://github.com/apmantza/GreedySearch-claude).
6
-
7
- ## Install
8
-
9
- ```bash
10
- pi install npm:@apmantza/greedysearch-pi
11
- ```
12
-
13
- Or directly from git:
14
-
15
- ```bash
16
- pi install git:github.com/apmantza/GreedySearch-pi
17
- ```
18
-
19
- ## Usage
20
-
21
- Once installed, Pi gains a `greedy_search` tool. The model will use it automatically for questions about current libraries, error messages, version-specific docs, etc.
22
-
23
- You can also invoke it directly:
24
-
25
- ```
26
- greedy_search({ query: "best way to handle auth in Next.js 15", engine: "all" })
27
- ```
28
-
29
- With Gemini synthesis:
30
-
31
- ```
32
- greedy_search({ query: "best way to handle auth in Next.js 15", engine: "all", synthesize: true })
33
- ```
34
-
35
- **Engines:**
36
- - `all` — fan-out to all three in parallel (default, highest confidence)
37
- - `perplexity` / `p` — best for technical Q&A
38
- - `bing` / `b` best for recent news and Microsoft ecosystem
39
- - `google` / `g` — best for broad coverage
40
- - `gemini` / `gem`Gemini standalone query
41
-
42
- **`synthesize: true`**
43
-
44
- Deduplicates sources across engines by consensus, feeds them to Gemini, and returns a single grounded answer instead of three separate responses. Adds ~30s to the request but reduces downstream token usage when passing results to a model.
45
-
46
- ## Requirements
47
-
48
- - Chrome must be running (or it auto-launches a dedicated instance via `launch.mjs`)
49
- - The `chrome-cdp` skill must be accessible (same CDP infrastructure as GreedySearch-claude)
50
-
51
- ## Setup (first time)
52
-
53
- To pre-launch the dedicated GreedySearch Chrome instance:
54
-
55
- ```bash
56
- node ~/.pi/agent/git/GreedySearch-pi/launch.mjs
57
- ```
58
-
59
- Stop it when done:
60
-
61
- ```bash
62
- node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --kill
63
- ```
64
-
65
- ## How It Works
66
-
67
- - `index.ts` — Pi extension, registers `greedy_search` tool
68
- - `search.mjs` CLI runner, spawns extractors in parallel
69
- - `launch.mjs` launches dedicated Chrome on port 9223
70
- - `extractors/` per-engine CDP scrapers (Perplexity, Bing Copilot, Google AI, Gemini)
1
+ # GreedySearch for Pi
2
+
3
+ Pi extension that adds a `greedy_search` tool — fans out queries to Perplexity, Bing Copilot, and Google AI simultaneously and returns AI-synthesized answers with deduped sources. Streams progress as each engine completes.
4
+
5
+ Forked from [GreedySearch-claude](https://github.com/apmantza/GreedySearch-claude).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pi install npm:@apmantza/greedysearch-pi
11
+ ```
12
+
13
+ Or directly from git:
14
+
15
+ ```bash
16
+ pi install git:github.com/apmantza/GreedySearch-pi
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ Once installed, Pi gains a `greedy_search` tool. The model will use it automatically for questions about current libraries, error messages, version-specific docs, etc.
22
+
23
+ ```
24
+ greedy_search({ query: "What's new in React 19?", engine: "all" })
25
+ ```
26
+
27
+ ## Parameters
28
+
29
+ | Parameter | Type | Default | Description |
30
+ |-----------|------|---------|-------------|
31
+ | `query` | string | required | The search question |
32
+ | `engine` | string | `"all"` | Engine to use (see below) |
33
+ | `synthesize` | boolean | `false` | Synthesize results into one answer via Gemini |
34
+ | `fullAnswer` | boolean | `false` | Return complete answer (~3000+ chars) vs truncated preview (~300 chars) |
35
+
36
+ ## Engines
37
+
38
+ | Engine | Alias | Latency | Best for |
39
+ |--------|-------|---------|----------|
40
+ | `all` | | 30-90s | Highest confidence all 3 engines in parallel (default) |
41
+ | `perplexity` | `p` | 15-30s | Technical Q&A, code explanations, documentation |
42
+ | `bing` | `b` | 15-30s | Recent news, Microsoft ecosystem |
43
+ | `google` | `g` | 15-30s | Broad coverage, multiple perspectives |
44
+ | `gemini` | `gem` | 15-30s | Google's AI with different training data |
45
+
46
+ ## Streaming Progress
47
+
48
+ When using `engine: "all"`, the tool streams progress as each engine completes:
49
+
50
+ ```
51
+ **Searching...** perplexity · ⏳ bing · ⏳ google
52
+ **Searching...** ✅ perplexity done · ⏳ bing · ⏳ google
53
+ **Searching...** perplexity done · bing done · ⏳ google
54
+ **Searching...** ✅ perplexity done · ✅ bing done · ✅ google done
55
+ ```
56
+
57
+ ## Synthesis Mode
58
+
59
+ For complex research questions, use `synthesize: true` with `engine: "all"`:
60
+
61
+ ```
62
+ greedy_search({ query: "best auth patterns for SaaS in 2026", engine: "all", synthesize: true })
63
+ ```
64
+
65
+ This deduplicates sources across engines and feeds them to Gemini for one clean, synthesized answer. Adds ~30s but produces the highest quality output with deduped sources showing consensus scores (`[2/3]`, `[3/3]`).
66
+
67
+ **Use synthesis when:**
68
+ - You need one definitive answer, not multiple perspectives
69
+ - You're researching a topic to write about or make a decision
70
+ - Token efficiency matters (one answer vs three)
71
+
72
+ **Skip synthesis when:**
73
+ - You want to see where engines disagree
74
+ - Speed matters
75
+
76
+ ## Full vs Short Answers
77
+
78
+ Default mode returns ~300 char summaries to save tokens. Use `fullAnswer: true` for complete responses:
79
+
80
+ ```
81
+ greedy_search({ query: "explain the React compiler", engine: "perplexity", fullAnswer: true })
82
+ ```
83
+
84
+ ## Examples
85
+
86
+ **Quick technical lookup:**
87
+ ```
88
+ greedy_search({ query: "How to use async await in Python", engine: "perplexity" })
89
+ ```
90
+
91
+ **Compare tools (see where engines agree/disagree):**
92
+ ```
93
+ greedy_search({ query: "Prisma vs Drizzle in 2026", engine: "all" })
94
+ ```
95
+
96
+ **Research with synthesis:**
97
+ ```
98
+ greedy_search({ query: "Best practices for monorepo structure", engine: "all", synthesize: true })
99
+ ```
100
+
101
+ **Debug an error:**
102
+ ```
103
+ greedy_search({ query: "Error: Cannot find module 'react-dom/client' Next.js 15", engine: "all" })
104
+ ```
105
+
106
+ ## Requirements
107
+
108
+ - **Chrome** — must be installed. The extension auto-launches a dedicated Chrome instance on port 9222 (separate from your main browser session).
109
+ - **Node.js 22+** — for built-in `fetch` and WebSocket support.
110
+
111
+ ## Setup (first time)
112
+
113
+ To pre-launch the dedicated GreedySearch Chrome instance:
114
+
115
+ ```bash
116
+ node ~/.pi/agent/git/GreedySearch-pi/launch.mjs
117
+ ```
118
+
119
+ Stop it when done:
120
+
121
+ ```bash
122
+ node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --kill
123
+ ```
124
+
125
+ Check status:
126
+
127
+ ```bash
128
+ node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --status
129
+ ```
130
+
131
+ ## Troubleshooting
132
+
133
+ ### "Chrome not found"
134
+ Set the path explicitly:
135
+ ```bash
136
+ export CHROME_PATH="/path/to/chrome"
137
+ ```
138
+
139
+ ### "CDP timeout" or "Chrome may have crashed"
140
+ Restart GreedySearch Chrome:
141
+ ```bash
142
+ node ~/.pi/agent/git/GreedySearch-pi/launch.mjs --kill
143
+ node ~/.pi/agent/git/GreedySearch-pi/launch.mjs
144
+ ```
145
+
146
+ ### Google / Bing "verify you're human"
147
+ The extension auto-clicks simple verification buttons. For CAPTCHAs, solve manually in the Chrome window that opens.
148
+
149
+ ### Search hangs
150
+ Chrome may be unresponsive. Restart it with `launch.mjs --kill` then `launch.mjs`.
151
+
152
+ ### Sources are junk links
153
+ This was a known issue with Gemini sources. If you're on an older version, update:
154
+ ```bash
155
+ pi install npm:@apmantza/greedysearch-pi
156
+ ```
157
+
158
+ ## How It Works
159
+
160
+ - `index.ts` — Pi extension, registers `greedy_search` tool with streaming progress
161
+ - `search.mjs` — CLI runner, spawns extractors in parallel, emits `PROGRESS:` events to stderr
162
+ - `launch.mjs` — launches dedicated Chrome on port 9222 with isolated profile
163
+ - `extractors/` — per-engine CDP scrapers (Perplexity, Bing Copilot, Google AI, Gemini)
164
+ - `cdp.mjs` — Chrome DevTools Protocol CLI for browser automation
165
+ - `skills/greedy-search/SKILL.md` — skill file that guides the model on when/how to use greedy_search
166
+
167
+ ## License
168
+
169
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apmantza/greedysearch-pi",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Pi extension: search Perplexity, Bing Copilot, and Google AI in parallel with optional Gemini synthesis — grounded AI answers, not just links",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,6 +0,0 @@
1
- {
2
- "query": "test query for file writing",
3
- "url": "https://www.perplexity.ai/search/test-query-for-file-writing-.FobTp2uSWSg70txH6RthQ",
4
- "answer": "This message is just a test query and does not trigger any actual file‑writing action on your system. \n\nIf you want, you can describe what kind of file you’d like to write (for example: a text file, Python script, CSV, etc.), and I can give you a concrete example in code that you can run…",
5
- "sources": []
6
- }