pi-web-providers 1.1.0 → 2.0.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 +175 -97
- package/dist/index.js +18032 -4393
- package/example-config.json +1 -83
- package/examples/{custom-cli → custom}/README.md +35 -19
- package/examples/{custom-cli → custom}/wrappers/gemini-contents.sh +6 -5
- package/package.json +11 -4
- /package/examples/{custom-cli → custom}/wrappers/claude-answer.sh +0 -0
- /package/examples/{custom-cli → custom}/wrappers/codex-search.sh +0 -0
- /package/examples/{custom-cli → custom}/wrappers/perplexity-research.sh +0 -0
package/example-config.json
CHANGED
|
@@ -1,87 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"tools": {
|
|
3
|
-
"search": "codex"
|
|
4
|
-
"contents": null,
|
|
5
|
-
"answer": null,
|
|
6
|
-
"research": null
|
|
7
|
-
},
|
|
8
|
-
"genericSettings": {
|
|
9
|
-
"requestTimeoutMs": 30000,
|
|
10
|
-
"retryCount": 3,
|
|
11
|
-
"retryDelayMs": 2000,
|
|
12
|
-
"researchPollIntervalMs": 3000,
|
|
13
|
-
"researchTimeoutMs": 21600000,
|
|
14
|
-
"researchMaxConsecutivePollErrors": 3
|
|
15
|
-
},
|
|
16
|
-
"providers": {
|
|
17
|
-
"claude": {
|
|
18
|
-
"enabled": false
|
|
19
|
-
},
|
|
20
|
-
"codex": {
|
|
21
|
-
"enabled": true,
|
|
22
|
-
"native": {
|
|
23
|
-
"networkAccessEnabled": true,
|
|
24
|
-
"webSearchEnabled": true,
|
|
25
|
-
"webSearchMode": "live"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"custom-cli": {
|
|
29
|
-
"enabled": false
|
|
30
|
-
},
|
|
31
|
-
"exa": {
|
|
32
|
-
"enabled": false,
|
|
33
|
-
"apiKey": "EXA_API_KEY",
|
|
34
|
-
"native": {
|
|
35
|
-
"type": "auto",
|
|
36
|
-
"contents": {
|
|
37
|
-
"text": true
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"gemini": {
|
|
42
|
-
"enabled": false,
|
|
43
|
-
"apiKey": "GOOGLE_API_KEY",
|
|
44
|
-
"native": {
|
|
45
|
-
"searchModel": "gemini-2.5-flash",
|
|
46
|
-
"answerModel": "gemini-2.5-flash",
|
|
47
|
-
"researchAgent": "deep-research-pro-preview-12-2025"
|
|
48
|
-
},
|
|
49
|
-
"policy": {
|
|
50
|
-
"researchMaxConsecutivePollErrors": 10
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"perplexity": {
|
|
54
|
-
"enabled": false,
|
|
55
|
-
"apiKey": "PERPLEXITY_API_KEY",
|
|
56
|
-
"native": {
|
|
57
|
-
"answer": {
|
|
58
|
-
"model": "sonar"
|
|
59
|
-
},
|
|
60
|
-
"research": {
|
|
61
|
-
"model": "sonar-deep-research"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"parallel": {
|
|
66
|
-
"enabled": false,
|
|
67
|
-
"apiKey": "PARALLEL_API_KEY",
|
|
68
|
-
"native": {
|
|
69
|
-
"search": {
|
|
70
|
-
"mode": "agentic"
|
|
71
|
-
},
|
|
72
|
-
"extract": {
|
|
73
|
-
"excerpts": true,
|
|
74
|
-
"full_content": false
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"valyu": {
|
|
79
|
-
"enabled": false,
|
|
80
|
-
"apiKey": "VALYU_API_KEY",
|
|
81
|
-
"native": {
|
|
82
|
-
"searchType": "all",
|
|
83
|
-
"responseLength": "short"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
3
|
+
"search": "codex"
|
|
86
4
|
}
|
|
87
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Custom
|
|
1
|
+
# Custom wrapper examples
|
|
2
2
|
|
|
3
3
|
These examples keep the wrapper logic small. They are bash scripts that use
|
|
4
4
|
`jq` for JSON handling. Each wrapper uses a different backend pattern:
|
|
@@ -30,27 +30,27 @@ You need:
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
mkdir -p ./wrappers
|
|
33
|
-
cp examples/custom
|
|
34
|
-
cp examples/custom
|
|
35
|
-
cp examples/custom
|
|
36
|
-
cp examples/custom
|
|
33
|
+
cp examples/custom/wrappers/codex-search.sh ./wrappers/
|
|
34
|
+
cp examples/custom/wrappers/gemini-contents.sh ./wrappers/
|
|
35
|
+
cp examples/custom/wrappers/claude-answer.sh ./wrappers/
|
|
36
|
+
cp examples/custom/wrappers/perplexity-research.sh ./wrappers/
|
|
37
37
|
chmod +x ./wrappers/*.sh
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Then configure `custom
|
|
40
|
+
Then configure `custom` like this:
|
|
41
41
|
|
|
42
42
|
```json
|
|
43
43
|
{
|
|
44
44
|
"tools": {
|
|
45
|
-
"search": "custom
|
|
46
|
-
"contents": "custom
|
|
47
|
-
"answer": "custom
|
|
48
|
-
"research": "custom
|
|
45
|
+
"search": "custom",
|
|
46
|
+
"contents": "custom",
|
|
47
|
+
"answer": "custom",
|
|
48
|
+
"research": "custom"
|
|
49
49
|
},
|
|
50
50
|
"providers": {
|
|
51
|
-
"custom
|
|
51
|
+
"custom": {
|
|
52
52
|
"enabled": true,
|
|
53
|
-
"
|
|
53
|
+
"options": {
|
|
54
54
|
"search": {
|
|
55
55
|
"argv": ["bash", "./wrappers/codex-search.sh"]
|
|
56
56
|
},
|
|
@@ -69,8 +69,9 @@ Then configure `custom-cli` like this:
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
`web_research`
|
|
73
|
-
|
|
72
|
+
`web_research` uses the same async workflow as every other research provider:
|
|
73
|
+
pi starts the wrapper in the background, tracks the job locally, and writes the
|
|
74
|
+
final report to a file when it finishes.
|
|
74
75
|
|
|
75
76
|
## Core command shapes
|
|
76
77
|
|
|
@@ -132,7 +133,7 @@ printf '%s' '{
|
|
|
132
133
|
"maxResults": 5,
|
|
133
134
|
"options": {},
|
|
134
135
|
"cwd": "'"$PWD"'"
|
|
135
|
-
}' | bash examples/custom
|
|
136
|
+
}' | bash examples/custom/wrappers/codex-search.sh
|
|
136
137
|
```
|
|
137
138
|
|
|
138
139
|
### Contents
|
|
@@ -143,7 +144,7 @@ printf '%s' '{
|
|
|
143
144
|
"urls": ["https://example.com"],
|
|
144
145
|
"options": {},
|
|
145
146
|
"cwd": "'"$PWD"'"
|
|
146
|
-
}' | bash examples/custom
|
|
147
|
+
}' | bash examples/custom/wrappers/gemini-contents.sh
|
|
147
148
|
```
|
|
148
149
|
|
|
149
150
|
### Answer
|
|
@@ -154,7 +155,7 @@ printf '%s' '{
|
|
|
154
155
|
"query": "What changed in the latest Claude Code release?",
|
|
155
156
|
"options": {},
|
|
156
157
|
"cwd": "'"$PWD"'"
|
|
157
|
-
}' | bash examples/custom
|
|
158
|
+
}' | bash examples/custom/wrappers/claude-answer.sh
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
### Research
|
|
@@ -165,7 +166,7 @@ printf '%s' '{
|
|
|
165
166
|
"input": "Compare current local agent CLIs for web-grounded tasks.",
|
|
166
167
|
"options": {},
|
|
167
168
|
"cwd": "'"$PWD"'"
|
|
168
|
-
}' | bash examples/custom
|
|
169
|
+
}' | bash examples/custom/wrappers/perplexity-research.sh
|
|
169
170
|
```
|
|
170
171
|
|
|
171
172
|
## Request and response contract
|
|
@@ -196,7 +197,22 @@ printf '%s' '{
|
|
|
196
197
|
}
|
|
197
198
|
```
|
|
198
199
|
|
|
199
|
-
### Contents
|
|
200
|
+
### Contents response
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"answers": [
|
|
205
|
+
{
|
|
206
|
+
"url": "https://example.com",
|
|
207
|
+
"content": "# Example\n\nMain page content",
|
|
208
|
+
"summary": "Optional short summary",
|
|
209
|
+
"metadata": {}
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Answer and research response
|
|
200
216
|
|
|
201
217
|
```json
|
|
202
218
|
{
|
|
@@ -13,11 +13,12 @@ prompt="$(
|
|
|
13
13
|
Extract the main textual content from these URLs:
|
|
14
14
|
$urls
|
|
15
15
|
|
|
16
|
-
Return JSON only with
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
16
|
+
Return JSON only with this shape:
|
|
17
|
+
- answers: an array with exactly $url_count items
|
|
18
|
+
- each answer must include the input url, and either:
|
|
19
|
+
- content: the extracted text as a string
|
|
20
|
+
- or error: a short error string when extraction fails
|
|
21
|
+
- optionally include summary and metadata
|
|
21
22
|
EOF
|
|
22
23
|
)"
|
|
23
24
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-providers",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Configurable web access extension for pi with per-tool provider routing for search, contents, answers, and research
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Configurable web access extension for pi with per-tool provider routing for search, contents, answers, and research.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -16,12 +16,15 @@
|
|
|
16
16
|
"coding-agent",
|
|
17
17
|
"web-search",
|
|
18
18
|
"claude",
|
|
19
|
+
"cloudflare",
|
|
19
20
|
"codex",
|
|
20
|
-
"custom
|
|
21
|
+
"custom",
|
|
21
22
|
"exa",
|
|
23
|
+
"firecrawl",
|
|
22
24
|
"gemini",
|
|
23
25
|
"perplexity",
|
|
24
26
|
"parallel",
|
|
27
|
+
"tavily",
|
|
25
28
|
"valyu"
|
|
26
29
|
],
|
|
27
30
|
"author": "mavam",
|
|
@@ -42,20 +45,24 @@
|
|
|
42
45
|
]
|
|
43
46
|
},
|
|
44
47
|
"scripts": {
|
|
45
|
-
"build": "rm -rf dist && esbuild src/index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --external:@mariozechner/pi-coding-agent --external:@mariozechner/pi-ai --external:@mariozechner/pi-tui --external:@sinclair/typebox --external:@anthropic-ai/claude-agent-sdk --external:@google/genai --external:@openai/codex-sdk --external:@perplexity-ai/perplexity_ai --external:exa-js --external:parallel-web --external:valyu-js",
|
|
48
|
+
"build": "rm -rf dist && esbuild src/index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --external:@mariozechner/pi-coding-agent --external:@mariozechner/pi-ai --external:@mariozechner/pi-tui --external:@sinclair/typebox --external:@anthropic-ai/claude-agent-sdk --external:@google/genai --external:@mendable/firecrawl-js --external:@openai/codex-sdk --external:@perplexity-ai/perplexity_ai --external:@tavily/core --external:cloudflare --external:exa-js --external:parallel-web --external:valyu-js",
|
|
46
49
|
"prepare": "npm run build",
|
|
47
50
|
"prepack": "npm run build",
|
|
48
51
|
"check": "tsc --noEmit",
|
|
49
52
|
"format": "biome format --write .",
|
|
50
53
|
"format:check": "biome format .",
|
|
54
|
+
"smoke:live": "npm run build && node scripts/live-smoke.mjs",
|
|
51
55
|
"test": "vitest run",
|
|
52
56
|
"test:watch": "vitest"
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
59
|
"@anthropic-ai/claude-agent-sdk": "^0.2.71",
|
|
56
60
|
"@google/genai": "^1.44.0",
|
|
61
|
+
"@mendable/firecrawl-js": "^4.18.1",
|
|
57
62
|
"@openai/codex-sdk": "^0.111.0",
|
|
58
63
|
"@perplexity-ai/perplexity_ai": "^0.26.1",
|
|
64
|
+
"@tavily/core": "^0.7.2",
|
|
65
|
+
"cloudflare": "^5.2.0",
|
|
59
66
|
"exa-js": "^2.7.0",
|
|
60
67
|
"parallel-web": "^0.3.1",
|
|
61
68
|
"valyu-js": "^2.5.9",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|