pi-web-search 1.0.2 โ†’ 1.2.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/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # pi-web-search
2
2
 
3
- A pi extension that provides web search and content analysis capabilities powered by Gemini API.
3
+ A pi extension that provides provider-native web search across Google Gemini, OpenAI, and Anthropic, plus Gemini-native URL Context analysis.
4
4
 
5
5
  ## Features
6
6
 
7
- - **๐Ÿ” Web Search** - Google search with citations
8
- - **๐Ÿ“„ URL Analysis** - Analyze web pages, PDFs, images, and YouTube videos (up to 20 URLs)
7
+ - **๐Ÿ” Web Search** - Provider-native web search across Google Gemini, OpenAI Responses, and Anthropic Messages
8
+ - **๐Ÿ“„ URL Context** - Gemini-native analysis of up to 20 public URLs, including web pages, documents, images, and YouTube videos
9
+ - **๐Ÿงพ Search telemetry** - Tool results include provider, search queries, result URLs, citations, and whether native search metadata was actually observed
10
+ - **๐Ÿ”— Canonicalized Google grounding links** - Gemini grounding redirect URLs are resolved to their underlying destination URLs when possible
9
11
 
10
12
  ## Installation
11
13
 
@@ -13,11 +15,81 @@ A pi extension that provides web search and content analysis capabilities powere
13
15
  pi install npm:pi-web-search
14
16
  ```
15
17
 
18
+ ## Release highlights for v1.2.0
19
+
20
+ - `web_search` now follows the current model across Google Gemini, OpenAI Responses, and Anthropic Messages
21
+ - `url_context` is explicitly Gemini-only and is removed from the active tool set for non-Gemini models
22
+ - Provider-native search telemetry now exposes queries, URLs, citations, and verification metadata in tool `details`
23
+ - Gemini grounding redirect URLs are resolved to canonical destination URLs when possible
24
+ - Real test scripts now read configuration from `.env` / `.env.example`
25
+ - The package now ships source-only TypeScript entrypoints for pi; no `dist/` build output is required in the project or published package
26
+
27
+ ## Behavior notes
28
+
29
+ - `web_search` follows the **currently selected model** when that model exposes a supported native search API.
30
+ - `web_search` supports Google Gemini, OpenAI Responses, Anthropic Messages, and compatible proxy providers exposing those APIs.
31
+ - `url_context` is intentionally **Gemini-only**. When the current model is not Gemini-compatible, the extension removes `url_context` from the active tool set and the executor also fast-fails with a clear unsupported-provider message as a second safety net.
32
+ - If `web_search` returns only plain text and does **not** return native search metadata, the tool output includes a warning and marks the result as ungrounded in `details`.
33
+ - If `url_context` does not return verified URL-context metadata, the tool output includes an explicit warning so the caller can distinguish a best-effort summary from a verified retrieval.
34
+ - For Gemini grounding results, the extension attempts to resolve Google redirect URLs to the final destination URL before returning `sources` / `searchResults`.
35
+
36
+ ## Tool matrix
37
+
38
+ | Tool | Google Gemini | OpenAI Responses | Anthropic Messages | Proxy providers exposing those APIs |
39
+ |---|---|---|---|---|
40
+ | `web_search` | โœ… | โœ… | โœ… | โœ… |
41
+ | `url_context` | โœ… | โŒ | โŒ | โœ…, but only when the selected model is Gemini-compatible |
42
+
16
43
  ## Configuration
17
44
 
18
45
  No special configuration required. Configure or login to any of the following model providers in pi, and it will be automatically detected and used:
19
46
 
20
- - google-antigravity
21
- - google-gemini-cli
47
+ ### For `web_search`
48
+
22
49
  - google
23
- - google-generative-ai
50
+ - google-generative-ai
51
+ - openai
52
+ - anthropic
53
+ - compatible proxy providers whose selected model API is OpenAI Responses, Anthropic Messages, or Google Generative AI
54
+
55
+ ### For `url_context`
56
+
57
+ - google
58
+ - google-generative-ai
59
+ - compatible proxy providers whose selected model API is Google Generative AI
60
+
61
+ ## Verification scripts
62
+
63
+ Create a local `.env` first, ideally by copying `.env.example`. Real-test scripts read all configuration from environment variables instead of hardcoding any provider or extension.
64
+
65
+ ```bash
66
+ # Mock/unit parsing tests
67
+ npm test
68
+
69
+ # Real multi-provider web_search verification using models from .env
70
+ node tests/real-web-search.mjs
71
+
72
+ # Real Gemini url_context verification using model from .env
73
+ # Passes when url_context either returns verified metadata/URLs
74
+ # or emits the explicit unverified-warning path.
75
+ node tests/real-url-context.mjs
76
+ ```
77
+
78
+ Example `.env` keys:
79
+
80
+ ```bash
81
+ PI_BIN=pi
82
+ PI_WEB_SEARCH_EXTENSION=./src/index.ts
83
+ PI_PROVIDER_EXTENSIONS=/path/to/provider-extension.ts
84
+ PI_WEB_SEARCH_MODEL_OPENAI=provider/model-openai
85
+ PI_WEB_SEARCH_MODEL_ANTHROPIC=provider/model-anthropic
86
+ PI_WEB_SEARCH_MODEL_GOOGLE=provider/model-google
87
+ PI_URL_CONTEXT_MODEL=provider/model-google
88
+ ```
89
+
90
+ Recommended setup:
91
+
92
+ ```bash
93
+ cp .env.example .env
94
+ # then edit .env with models/extensions available in your local pi setup
95
+ ```
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "pi-web-search",
3
- "version": "1.0.2",
4
- "description": "Web search and content analysis extension for pi, powered by Gemini API",
3
+ "version": "1.2.0",
4
+ "description": "Provider-native web search for pi across Google Gemini, OpenAI, and Anthropic, plus Gemini URL Context",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "main": "src/index.ts",
8
7
  "keywords": [
9
8
  "pi",
10
9
  "pi-extension",
11
10
  "web-search",
12
11
  "gemini",
13
12
  "google",
13
+ "openai",
14
+ "anthropic",
15
+ "url-context",
14
16
  "url-analysis",
15
17
  "youtube"
16
18
  ],
@@ -24,13 +26,25 @@
24
26
  "url": "https://github.com/ttttmr/pi-web-search/issues"
25
27
  },
26
28
  "homepage": "https://github.com/ttttmr/pi-web-search#readme",
29
+ "files": [
30
+ "src",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "test": "node --test tests/*.test.mjs",
35
+ "test:real:web-search": "node tests/real-web-search.mjs",
36
+ "test:real:url-context": "node tests/real-url-context.mjs"
37
+ },
27
38
  "devDependencies": {
28
- "@mariozechner/pi-coding-agent": "^0.51.5",
29
- "@sinclair/typebox": "^0.32.15",
30
- "typescript": "^5.0.0",
31
- "@types/node": "^20.0.0"
39
+ "@earendil-works/pi-ai": "^0.75.4",
40
+ "@earendil-works/pi-coding-agent": "^0.75.4",
41
+ "@sinclair/typebox": "^0.34.49",
42
+ "@types/node": "^25.9.1",
43
+ "typescript": "^6.0.3"
32
44
  },
33
45
  "pi": {
34
- "extensions": ["./src/index.ts"]
46
+ "extensions": [
47
+ "./src/index.ts"
48
+ ]
35
49
  }
36
50
  }