@juicesharp/rpiv-web-tools 1.1.4 → 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 +59 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,10 +17,10 @@ Let the model search the web and read pages. `rpiv-web-tools` adds `web_search`
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
- **Brave-backed search**
|
|
21
|
-
- **Read any URL**
|
|
22
|
-
- **Large-page spillover**
|
|
23
|
-
- **Interactive setup**
|
|
20
|
+
- **Brave-backed search** - 1–10 ranked results per query with title and snippet.
|
|
21
|
+
- **Read any URL** - fetch http/https pages, strip HTML to text, or get the raw HTML with `raw: true`.
|
|
22
|
+
- **Large-page spillover** - oversized responses truncate inline and spill the full body to a temp file the model can read on demand.
|
|
23
|
+
- **Interactive setup** - `/web-search-config` writes the key to `~/.config/rpiv-web-tools/config.json` (chmod 0600); env var `BRAVE_SEARCH_API_KEY` also works.
|
|
24
24
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
@@ -32,15 +32,67 @@ Then restart your Pi session.
|
|
|
32
32
|
|
|
33
33
|
## Tools
|
|
34
34
|
|
|
35
|
-
- **`web_search`**
|
|
35
|
+
- **`web_search`** - query the Brave Search API and return titled snippets.
|
|
36
36
|
1–10 results per call.
|
|
37
|
-
- **`web_fetch`**
|
|
37
|
+
- **`web_fetch`** - fetch an http/https URL, strip HTML to text (or return raw
|
|
38
38
|
HTML with `raw: true`), truncate large responses with a temp-file spill for
|
|
39
39
|
the full content.
|
|
40
40
|
|
|
41
|
+
### Schema - `web_search`
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
web_search({
|
|
45
|
+
query: string, // natural-language query
|
|
46
|
+
max_results?: number, // 1-10, default 5
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
{
|
|
54
|
+
content: [{ type: "text", text: string }], // markdown list of "**title**\n url\n snippet"
|
|
55
|
+
details: {
|
|
56
|
+
query: string,
|
|
57
|
+
backend: "brave",
|
|
58
|
+
resultCount: number,
|
|
59
|
+
results?: Array<{ title: string, url: string, snippet: string }>,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Throws when `BRAVE_SEARCH_API_KEY` is unset or the Brave API returns a non-2xx response.
|
|
65
|
+
|
|
66
|
+
### Schema - `web_fetch`
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
web_fetch({
|
|
70
|
+
url: string, // http or https only
|
|
71
|
+
raw?: boolean, // true → return raw HTML; default false → strip to text
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
{
|
|
79
|
+
content: [{ type: "text", text: string }], // header (URL/title/content-type) + body
|
|
80
|
+
details: {
|
|
81
|
+
url: string,
|
|
82
|
+
title?: string, // <title> element, if present (HTML, non-raw)
|
|
83
|
+
contentType?: string,
|
|
84
|
+
contentLength?: number, // from Content-Length header
|
|
85
|
+
truncation?: TruncationResult, // present when body exceeded inline limits
|
|
86
|
+
fullOutputPath?: string, // temp-file path containing the un-truncated body
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Throws on invalid URL, non-http(s) protocol, non-2xx response, or `image/` / `video/` / `audio/` content types.
|
|
92
|
+
|
|
41
93
|
## Commands
|
|
42
94
|
|
|
43
|
-
- **`/web-search-config`**
|
|
95
|
+
- **`/web-search-config`** - set the Brave API key interactively. Writes to
|
|
44
96
|
`~/.config/rpiv-web-tools/config.json` (chmod 0600). Pass `--show` to see
|
|
45
97
|
the current (masked) key and env var status.
|
|
46
98
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-web-tools",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Pi extension
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Pi extension. Web search and fetch for the model, backed by the Brave Search API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"pi-extension",
|