@mrclrchtr/supi-web 4.3.0 → 4.5.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
|
@@ -6,101 +6,89 @@
|
|
|
6
6
|
</a>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
|
-
# @mrclrchtr/supi-web
|
|
9
|
+
# @mrclrchtr/supi-web — Web Fetch and Context7 for Pi
|
|
10
10
|
|
|
11
|
-
Adds web
|
|
11
|
+
Adds web fetch and Context7 documentation tools to the [Pi coding agent](https://github.com/earendil-works/pi), without making you paste sources into chat.
|
|
12
12
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pi install npm:@mrclrchtr/supi-web
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
For local development:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pi install ./packages/supi-web
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-

|
|
26
|
-
|
|
27
|
-
## What you get
|
|
13
|
+
## What your agent gets
|
|
28
14
|
|
|
29
|
-
After
|
|
15
|
+
After installation, keep asking Pi normal questions. The agent can:
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
- **Read public web pages as clean Markdown** — extract the main article instead of returning navigation, scripts, styles, and raw HTML.
|
|
18
|
+
- **Prefer source Markdown when available** — detect Markdown responses and common Markdown siblings before converting HTML.
|
|
19
|
+
- **Handle plain-text and source files** — wrap them in fenced code blocks with a language hint when the URL provides one.
|
|
20
|
+
- **Look up current library docs** — search Context7 for the right project and version, then retrieve documentation focused on the task at hand.
|
|
21
|
+
- **Protect the context window** — return small results inline, move long pages to temporary files, and preserve full output when model-visible text must be truncated.
|
|
32
22
|
|
|
23
|
+
Relative page links and images become absolute by default, so the agent can follow them without reconstructing URLs.
|
|
33
24
|
|
|
34
|
-
|
|
35
|
-
|------|---------|
|
|
36
|
-
| `web_fetch_md` | Fetch a web page and convert it to clean Markdown for LLM ingestion |
|
|
37
|
-
| `web_docs_search` | Search Context7 for library IDs and metadata before fetching docs |
|
|
38
|
-
| `web_docs_fetch` | Fetch up-to-date documentation for a known Context7 library |
|
|
25
|
+
## Example requests
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
You do not need to learn the tool-call syntax. Try asking Pi:
|
|
41
28
|
|
|
42
|
-
|
|
29
|
+
- “Read this public design document and summarize the decisions: `https://example.com/spec`.”
|
|
30
|
+
- “Check the current React documentation for effect cleanup.”
|
|
31
|
+
- “Find the FastAPI docs for lifespan events and show the recommended pattern.”
|
|
32
|
+
- “Fetch this long reference page to a file, then read only the relevant section.”
|
|
33
|
+
- “Compare this library's current docs with the code in the repository.”
|
|
43
34
|
|
|
44
|
-
|
|
35
|
+
## Agent tools
|
|
45
36
|
|
|
46
|
-
|
|
47
|
-
|-----------|------|----------|---------|-------------|
|
|
48
|
-
| `url` | string | ✓ | — | `http://` or `https://` URL to fetch |
|
|
49
|
-
| `output_mode` | `"auto"` \| `"inline"` \| `"file"` | — | `"auto"` | How to return the result |
|
|
50
|
-
| `abs_links` | boolean | — | `true` | Absolutize relative links and images |
|
|
51
|
-
| `timeout_ms` | number | — | `30000` | Fetch timeout in milliseconds |
|
|
37
|
+
The package adds three tools that Pi selects as needed:
|
|
52
38
|
|
|
53
|
-
|
|
39
|
+
| Tool | What it lets the agent do |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `web_fetch_md` | Fetch a public HTTP(S) page and return readable Markdown, fenced plain text, or a temporary file |
|
|
42
|
+
| `web_docs_search` | Find matching Context7 library IDs, versions, trust scores, benchmark scores, and snippet counts |
|
|
43
|
+
| `web_docs_fetch` | Retrieve focused documentation for a chosen Context7 library ID |
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
- **`inline`** — returns Markdown inline, truncated to PI's model-visible output limit when necessary
|
|
57
|
-
- **`file`** — always writes to a temporary file and returns the path
|
|
45
|
+
Pi searches Context7 first when the library ID is unknown, then fetches docs with the selected ID. Narrow questions produce more useful documentation context than broad requests. Documentation returns as Markdown by default; the agent can request structured JSON snippets when needed.
|
|
58
46
|
|
|
59
|
-
|
|
47
|
+
## How page fetching works
|
|
60
48
|
|
|
61
|
-
|
|
62
|
-
- Access-controlled pages (login, paywall) should be skipped — ask the user for an allowed source instead
|
|
63
|
-
- Plain-text responses are wrapped in fenced code blocks
|
|
64
|
-
- Model-visible inline output is truncated to 2,000 lines or 50KB; full truncated output is saved to a temp file
|
|
65
|
-
- Links and images are absolutized by default; set `abs_links: false` to keep them relative
|
|
49
|
+
`web_fetch_md` chooses the cleanest representation it can find:
|
|
66
50
|
|
|
67
|
-
|
|
51
|
+
1. Use Markdown returned directly by the server.
|
|
52
|
+
2. Detect Markdown or plain text from the response content.
|
|
53
|
+
3. Check common `.md`, `.markdown`, `index.md`, and `README.md` alternatives.
|
|
54
|
+
4. For HTML, extract the primary readable content and convert it to GitHub-flavored Markdown.
|
|
68
55
|
|
|
69
|
-
|
|
56
|
+
It follows redirects, removes scripts and styles, preserves useful structures such as headings, links, lists, code blocks, and tables, and makes relative links absolute by default.
|
|
70
57
|
|
|
71
|
-
###
|
|
58
|
+
### Large pages
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|-----------|------|----------|-------------|
|
|
75
|
-
| `library_name` | string | ✓ | Library name to search for (e.g. `"react"`, `"next.js"`) |
|
|
76
|
-
| `query` | string | ✓ | What you're trying to do — used for relevance ranking |
|
|
60
|
+
The default `auto` mode returns content inline up to 15,000 characters and writes larger pages to a temporary Markdown file. You can ask Pi to force inline or file output.
|
|
77
61
|
|
|
78
|
-
|
|
62
|
+
All three tools cap model-visible inline output at Pi's 2,000-line / 50KB limit. If output is truncated, the complete result is saved to a temporary file for follow-up reads.
|
|
79
63
|
|
|
80
|
-
|
|
64
|
+
Tool rows stay collapsed in Pi's TUI by default. Press `Ctrl+O` to expand their inline output.
|
|
81
65
|
|
|
82
|
-
|
|
66
|
+
## Install
|
|
83
67
|
|
|
84
|
-
|
|
68
|
+
```bash
|
|
69
|
+
pi install npm:@mrclrchtr/supi-web
|
|
70
|
+
```
|
|
85
71
|
|
|
86
|
-
|
|
87
|
-
|-----------|------|----------|---------|-------------|
|
|
88
|
-
| `library_id` | string | ✓ | — | Context7 library ID (e.g. `/facebook/react`, `/vercel/next.js`) |
|
|
89
|
-
| `query` | string | ✓ | — | Specific question about the library |
|
|
90
|
-
| `raw` | boolean | — | `false` | When `true`, returns JSON-serialized snippet objects instead of Markdown |
|
|
72
|
+
To try it for one run without installing:
|
|
91
73
|
|
|
92
|
-
|
|
74
|
+
```bash
|
|
75
|
+
pi -e npm:@mrclrchtr/supi-web
|
|
76
|
+
```
|
|
93
77
|
|
|
94
|
-
##
|
|
78
|
+
## Context7 API key
|
|
95
79
|
|
|
96
|
-
|
|
97
|
-
2. **Pick a `library_id`** from the results
|
|
98
|
-
3. **`web_docs_fetch`** — retrieve focused, version-aware docs
|
|
80
|
+
The documentation tools call the [Context7 API](https://context7.com/). Create a free key at <https://context7.com/dashboard>, export it before starting Pi, and keep it out of repository files:
|
|
99
81
|
|
|
100
|
-
|
|
82
|
+
```bash
|
|
83
|
+
export CONTEXT7_API_KEY="ctx7sk-..."
|
|
84
|
+
pi
|
|
85
|
+
```
|
|
101
86
|
|
|
102
|
-
|
|
87
|
+
`web_fetch_md` does not use Context7 and needs no API key.
|
|
103
88
|
|
|
104
|
-
|
|
89
|
+
## Boundaries
|
|
105
90
|
|
|
106
|
-
|
|
91
|
+
- `web_fetch_md` is for public `http://` and `https://` sources. It does not authenticate to login-protected, private, or paywalled pages.
|
|
92
|
+
- It fetches HTTP responses and does not run a browser, page JavaScript, or interactive flows; client-rendered pages may expose little useful content.
|
|
93
|
+
- When the `gh` CLI is available, Pi is guided to use it instead for GitHub URLs.
|
|
94
|
+
- Fetched pages are external, untrusted content. Treat them as source material, not as repository instructions.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-web",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.5.0",
|
|
4
|
+
"description": "Web fetch and Context7 documentation extension for the Pi coding agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"README.md"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"jsdom": "^
|
|
35
|
+
"jsdom": "^30.0.0",
|
|
36
36
|
"@mozilla/readability": "^0.6.0",
|
|
37
37
|
"turndown": "^7.2.0",
|
|
38
38
|
"turndown-plugin-gfm": "^1.0.2",
|
|
39
|
-
"@mrclrchtr/supi-core": "4.
|
|
39
|
+
"@mrclrchtr/supi-core": "4.5.0"
|
|
40
40
|
},
|
|
41
41
|
"bundledDependencies": [
|
|
42
42
|
"@mrclrchtr/supi-core"
|