pi-web-providers 0.1.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/LICENSE +21 -0
- package/README.md +248 -0
- package/dist/index.js +2802 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# ๐ pi-web-providers
|
|
2
|
+
|
|
3
|
+
A *meta* web extension for [pi](https://pi.dev).
|
|
4
|
+
|
|
5
|
+
## Why?
|
|
6
|
+
|
|
7
|
+
Most web extensions hard-wire a single search-and-fetch pipeline. That works
|
|
8
|
+
until you want to swap providers, compare results, or use a capabilityโlike deep
|
|
9
|
+
researchโthat only one backend offers.
|
|
10
|
+
|
|
11
|
+
**pi-web-providers** takes a different approach: it doesn't do web work itself.
|
|
12
|
+
Instead it dispatches every request to a **configurable set of providers**,
|
|
13
|
+
giving you maximum flexibility and choice when it comes to consuming web results.
|
|
14
|
+
|
|
15
|
+
The tool surface is **capability-based, not static**. At startup the extension
|
|
16
|
+
inspects which providers are available and what each one supports, then registers
|
|
17
|
+
only the tools that make sense. If your active provider offers search and
|
|
18
|
+
content extraction but not deep research, the agent never sees a research tool.
|
|
19
|
+
Switch to a provider that supports it and the tool appears automatically.
|
|
20
|
+
|
|
21
|
+
## โจ Features
|
|
22
|
+
|
|
23
|
+
- **Provider-driven tool surface** โ tools are injected based on what the active
|
|
24
|
+
provider actually supports, not a fixed list
|
|
25
|
+
- **Five providers**: Codex, Exa, Gemini, Parallel, Valyu โ each with its own
|
|
26
|
+
SDK, strengths, and capability set
|
|
27
|
+
- **One config command** (`/web-providers`) with a TUI that adapts to the
|
|
28
|
+
selected provider
|
|
29
|
+
- **Transparent fallback** โ if no provider is explicitly enabled, the extension
|
|
30
|
+
walks the list alphabetically and picks the first one that is available
|
|
31
|
+
- **Per-provider tool toggles** โ disable individual capabilities you don't need
|
|
32
|
+
without switching providers
|
|
33
|
+
- **Truncated output with temp-file spillover** for large results
|
|
34
|
+
|
|
35
|
+
## ๐ฆ Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pi install npm:pi-web-providers
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## โ๏ธ Configure
|
|
42
|
+
|
|
43
|
+
Run:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
/web-providers
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This command edits a single global config file:
|
|
50
|
+
`~/.pi/agent/web-providers.json`.
|
|
51
|
+
|
|
52
|
+
The flow is provider-first: pick the active provider, then configure only that
|
|
53
|
+
provider's tool toggles and settings. Each provider view surfaces the knobs that
|
|
54
|
+
actually applyโCodex shows reasoning-effort and web-search-mode toggles; Exa
|
|
55
|
+
shows search type and text-content flags; and so on.
|
|
56
|
+
|
|
57
|
+
## ๐ง Tools
|
|
58
|
+
|
|
59
|
+
Which of the tools below are registered depends on the capabilities of the
|
|
60
|
+
available providers. If no provider supports a given capability, the
|
|
61
|
+
corresponding tool is never exposed to the agent.
|
|
62
|
+
|
|
63
|
+
### `web_search`
|
|
64
|
+
|
|
65
|
+
Search the web and return titles, URLs, and snippets.
|
|
66
|
+
|
|
67
|
+
| Parameter | Type | Default | Description |
|
|
68
|
+
|-----------|------|---------|-------------|
|
|
69
|
+
| `query` | string | required | What to search for |
|
|
70
|
+
| `maxResults` | integer | `5` | Result count, clamped to `1โ20` |
|
|
71
|
+
| `provider` | string | auto | Optional override: `codex`, `exa`, `gemini`, `parallel`, or `valyu` |
|
|
72
|
+
|
|
73
|
+
### `web_contents`
|
|
74
|
+
|
|
75
|
+
Extract contents for one or more URLs.
|
|
76
|
+
|
|
77
|
+
| Parameter | Type | Default | Description |
|
|
78
|
+
|-----------|------|---------|-------------|
|
|
79
|
+
| `urls` | string[] | required | One or more URLs to extract |
|
|
80
|
+
| `options` | object | โ | Provider-specific extraction options |
|
|
81
|
+
| `provider` | string | auto | Optional override among providers that support contents |
|
|
82
|
+
|
|
83
|
+
### `web_answer`
|
|
84
|
+
|
|
85
|
+
Get a provider-generated answer grounded in search results.
|
|
86
|
+
|
|
87
|
+
| Parameter | Type | Default | Description |
|
|
88
|
+
|-----------|------|---------|-------------|
|
|
89
|
+
| `query` | string | required | Question to answer |
|
|
90
|
+
| `options` | object | โ | Provider-specific answer options |
|
|
91
|
+
| `provider` | string | auto | Optional override among providers that support answers |
|
|
92
|
+
|
|
93
|
+
### `web_research`
|
|
94
|
+
|
|
95
|
+
Run a longer-form research task.
|
|
96
|
+
|
|
97
|
+
| Parameter | Type | Default | Description |
|
|
98
|
+
|-----------|------|---------|-------------|
|
|
99
|
+
| `input` | string | required | Research brief or question |
|
|
100
|
+
| `options` | object | โ | Provider-specific research options |
|
|
101
|
+
| `provider` | string | auto | Optional override among providers that support research |
|
|
102
|
+
|
|
103
|
+
## ๐ Providers
|
|
104
|
+
|
|
105
|
+
Every provider is a thin adapter around an official SDK. The table below
|
|
106
|
+
summarises which capabilities each provider exposes:
|
|
107
|
+
|
|
108
|
+
| Provider | search | contents | answer | research | Auth |
|
|
109
|
+
|----------|:------:|:--------:|:------:|:--------:|------|
|
|
110
|
+
| **Codex** | โ | | | | Local Codex CLI auth |
|
|
111
|
+
| **Exa** | โ | โ | โ | โ | `EXA_API_KEY` |
|
|
112
|
+
| **Gemini** | โ | | โ | โ | `GOOGLE_API_KEY` |
|
|
113
|
+
| **Parallel** | โ | โ | | | `PARALLEL_API_KEY` |
|
|
114
|
+
| **Valyu** | โ | โ | โ | โ | `VALYU_API_KEY` |
|
|
115
|
+
|
|
116
|
+
### Codex
|
|
117
|
+
|
|
118
|
+
- SDK: `@openai/codex-sdk`
|
|
119
|
+
- Runs in read-only mode with web search enabled
|
|
120
|
+
- Best if you already use the local Codex CLI and auth flow
|
|
121
|
+
|
|
122
|
+
### Exa
|
|
123
|
+
|
|
124
|
+
- SDK: `exa-js`
|
|
125
|
+
- Neural, keyword, hybrid, and deep-research search modes
|
|
126
|
+
- Inline text-content extraction on search results
|
|
127
|
+
|
|
128
|
+
### Gemini
|
|
129
|
+
|
|
130
|
+
- SDK: `@google/genai`
|
|
131
|
+
- Grounded answers and deep-research agents via Google's Gemini API
|
|
132
|
+
|
|
133
|
+
### Parallel
|
|
134
|
+
|
|
135
|
+
- SDK: `parallel-web`
|
|
136
|
+
- Agentic and one-shot search modes
|
|
137
|
+
- Page content extraction with excerpt and full-content toggles
|
|
138
|
+
|
|
139
|
+
### Valyu
|
|
140
|
+
|
|
141
|
+
- SDK: `valyu-js`
|
|
142
|
+
- Web, proprietary, and news search types
|
|
143
|
+
- Configurable response length for answers and research
|
|
144
|
+
|
|
145
|
+
## ๐ Config Notes
|
|
146
|
+
|
|
147
|
+
- `/web-providers` keeps exactly one provider active by writing `enabled: true`
|
|
148
|
+
for the selected provider and `enabled: false` for the others
|
|
149
|
+
- Each provider can also enable or disable its individual tools through a `tools`
|
|
150
|
+
block
|
|
151
|
+
- If a config has no explicitly enabled provider, the extension falls back to the
|
|
152
|
+
first available provider alphabetically
|
|
153
|
+
- Secret-like values can be:
|
|
154
|
+
- literal strings
|
|
155
|
+
- environment variable names such as `EXA_API_KEY`
|
|
156
|
+
- shell commands prefixed with `!`
|
|
157
|
+
|
|
158
|
+
Example:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"version": 1,
|
|
163
|
+
"providers": {
|
|
164
|
+
"codex": {
|
|
165
|
+
"enabled": true,
|
|
166
|
+
"tools": {
|
|
167
|
+
"search": true
|
|
168
|
+
},
|
|
169
|
+
"defaults": {
|
|
170
|
+
"webSearchMode": "live",
|
|
171
|
+
"networkAccessEnabled": true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"exa": {
|
|
175
|
+
"enabled": false,
|
|
176
|
+
"tools": {
|
|
177
|
+
"search": true,
|
|
178
|
+
"contents": true,
|
|
179
|
+
"answer": true,
|
|
180
|
+
"research": true
|
|
181
|
+
},
|
|
182
|
+
"apiKey": "EXA_API_KEY",
|
|
183
|
+
"defaults": {
|
|
184
|
+
"type": "auto",
|
|
185
|
+
"contents": {
|
|
186
|
+
"text": true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"gemini": {
|
|
191
|
+
"enabled": false,
|
|
192
|
+
"tools": {
|
|
193
|
+
"search": true,
|
|
194
|
+
"answer": true,
|
|
195
|
+
"research": true
|
|
196
|
+
},
|
|
197
|
+
"apiKey": "GOOGLE_API_KEY",
|
|
198
|
+
"defaults": {
|
|
199
|
+
"searchModel": "gemini-2.5-flash",
|
|
200
|
+
"answerModel": "gemini-2.5-flash",
|
|
201
|
+
"researchAgent": "deep-research-pro-preview-12-2025"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"parallel": {
|
|
205
|
+
"enabled": false,
|
|
206
|
+
"tools": {
|
|
207
|
+
"search": true,
|
|
208
|
+
"contents": true
|
|
209
|
+
},
|
|
210
|
+
"apiKey": "PARALLEL_API_KEY",
|
|
211
|
+
"defaults": {
|
|
212
|
+
"search": {
|
|
213
|
+
"mode": "agentic"
|
|
214
|
+
},
|
|
215
|
+
"extract": {
|
|
216
|
+
"excerpts": true,
|
|
217
|
+
"full_content": false
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"valyu": {
|
|
222
|
+
"enabled": false,
|
|
223
|
+
"tools": {
|
|
224
|
+
"search": true,
|
|
225
|
+
"contents": true,
|
|
226
|
+
"answer": true,
|
|
227
|
+
"research": true
|
|
228
|
+
},
|
|
229
|
+
"apiKey": "VALYU_API_KEY",
|
|
230
|
+
"defaults": {
|
|
231
|
+
"searchType": "all",
|
|
232
|
+
"responseLength": "short"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## ๐ ๏ธ Development
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
npm run check
|
|
243
|
+
npm test
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## ๐ License
|
|
247
|
+
|
|
248
|
+
[MIT](LICENSE)
|