oira666_pi-web-search 0.0.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 +48 -0
- package/package.json +56 -0
- package/src/api.ts +1020 -0
- package/src/index.ts +92 -0
- package/src/url_context.ts +164 -0
- package/src/utils.ts +43 -0
- package/src/web_search.ts +127 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# oira666_pi-web-search
|
|
2
|
+
|
|
3
|
+
Provider-native web search for [pi](https://github.com/earendil-works/pi-coding-agent), across the currently selected Google Gemini, OpenAI, or Anthropic model, plus Gemini-only URL Context analysis.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
### `web_search`
|
|
8
|
+
|
|
9
|
+
Search the web using your currently selected model. Automatically picks the right provider API:
|
|
10
|
+
|
|
11
|
+
| Provider | API |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Google Gemini | Grounding with Google Search |
|
|
14
|
+
| OpenAI | Responses API web search, including pi's `openai-codex` OAuth Responses backend |
|
|
15
|
+
| Anthropic | Messages API web search, including Claude Code OAuth subscription tokens |
|
|
16
|
+
|
|
17
|
+
Supports passing up to 20 additional URLs to analyze alongside the query.
|
|
18
|
+
|
|
19
|
+
### `url_context`
|
|
20
|
+
|
|
21
|
+
Gemini-only. Analyze up to 20 public URLs — web pages, documents, images, and YouTube videos. Uses Gemini's native URL Context retrieval with verified metadata.
|
|
22
|
+
|
|
23
|
+
When using `google-generative-ai`, YouTube URLs are passed as `file_data` for native video understanding.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pi install npm:oira666_pi-web-search
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
No extra config needed. Select a supported provider/model in pi and the tools use the currently selected session model.
|
|
34
|
+
|
|
35
|
+
The extension does not switch models or fall back to another configured model. If the currently selected model does not support provider-native web search, `web_search` is automatically removed from active tools. `url_context` is automatically removed from active tools when using a non-Gemini model.
|
|
36
|
+
|
|
37
|
+
## Test
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cp .env.example .env # edit with your models
|
|
41
|
+
npm test # unit tests
|
|
42
|
+
npm run test:real:web-search
|
|
43
|
+
npm run test:real:url-context
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "oira666_pi-web-search",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Provider-native web search for pi across Google Gemini, OpenAI, and Anthropic, plus Gemini URL Context",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"pi",
|
|
9
|
+
"pi-extension",
|
|
10
|
+
"pi-package",
|
|
11
|
+
"web-search",
|
|
12
|
+
"gemini",
|
|
13
|
+
"google",
|
|
14
|
+
"openai",
|
|
15
|
+
"anthropic",
|
|
16
|
+
"url-context",
|
|
17
|
+
"url-analysis",
|
|
18
|
+
"youtube"
|
|
19
|
+
],
|
|
20
|
+
"author": "oira666",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/gee666/pi-web-search.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/gee666/pi-web-search/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/gee666/pi-web-search#readme",
|
|
30
|
+
"files": [
|
|
31
|
+
"src",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"test": "node --test tests/*.test.mjs",
|
|
36
|
+
"test:real:web-search": "node tests/real-web-search.mjs",
|
|
37
|
+
"test:real:url-context": "node tests/real-url-context.mjs"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@earendil-works/pi-ai": "^0.75.4",
|
|
41
|
+
"@earendil-works/pi-coding-agent": "^0.75.4",
|
|
42
|
+
"@types/node": "^25.9.1",
|
|
43
|
+
"typebox": "^1.1.38",
|
|
44
|
+
"typescript": "^6.0.3"
|
|
45
|
+
},
|
|
46
|
+
"pi": {
|
|
47
|
+
"extensions": [
|
|
48
|
+
"./src/index.ts"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@earendil-works/pi-ai": "*",
|
|
53
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
54
|
+
"typebox": "*"
|
|
55
|
+
}
|
|
56
|
+
}
|