pi-querit 1.1.1 → 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/CHANGELOG.md +37 -0
- package/README.md +31 -11
- package/index.ts +2 -0
- package/package.json +8 -6
- package/src/client.ts +296 -49
- package/src/config.ts +31 -9
- package/src/format.ts +38 -11
- package/src/index.ts +109 -33
- package/src/output.ts +22 -7
- package/src/sanitize.ts +5 -0
- package/src/setup.ts +37 -36
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.0 - 2026-11-27
|
|
4
|
+
|
|
5
|
+
Pi reads this file when the package updates. Dates are YYYY-MM-DD.
|
|
6
|
+
|
|
7
|
+
### Pi
|
|
8
|
+
|
|
9
|
+
- Type-checked and tested against Pi 1.6.1 (previously 0.83.0). Works on
|
|
10
|
+
older Pi versions too: nothing here needs a newer runtime API.
|
|
11
|
+
- `web_search` and `fetch_content` now declare `readOnlyHint` and
|
|
12
|
+
`openWorldHint`. Without them, a permission extension assumes the MCP
|
|
13
|
+
defaults and may ask for confirmation on every search.
|
|
14
|
+
- Truncated output goes to `pi-querit-<uid>` in the OS temp folder, one
|
|
15
|
+
directory per user, with mode `0700`; files are mode `0600`. Leftovers in
|
|
16
|
+
the old shared `pi-querit` folder are still cleaned up.
|
|
17
|
+
|
|
18
|
+
### Querit API (per the reference updated 2026-11-24)
|
|
19
|
+
|
|
20
|
+
- `web_search` takes an optional `vertical`: `"code"` for programming
|
|
21
|
+
questions, `"finance"` for markets and companies. A configured `rank` is
|
|
22
|
+
dropped for code searches, which the API rejects with `rank`.
|
|
23
|
+
- New defaults in `querit-search.json`: `highlights`, `contentMaxChars`,
|
|
24
|
+
`rank`, and `needMarkdown` (Enterprise). See the README's advanced options.
|
|
25
|
+
- `fetch_content` takes `max_chars`, `highlight_query`, and
|
|
26
|
+
`highlight_max_chars`.
|
|
27
|
+
- `count` now goes up to 100 and is left unset by default, so Querit applies
|
|
28
|
+
its own server default. Before, the extension always asked for 5. To keep
|
|
29
|
+
that behavior, set `"count": 5` in `/querit-setup`.
|
|
30
|
+
- `chunksPerDoc` is deprecated by Querit and is no longer sent unless your
|
|
31
|
+
configuration sets it. Switch to `highlights`.
|
|
32
|
+
- Results carry highlights and Markdown fields when requested, and the
|
|
33
|
+
result line shows Querit's per-request cost when it reports one.
|
|
34
|
+
- `russian` is accepted as a language.
|
|
35
|
+
- HTTP 429, 500, and 503 are retried with bounded backoff and honor
|
|
36
|
+
`Retry-After`; 400, 401, 403, and 404 are never retried. Failure messages
|
|
37
|
+
end with the request's `search_id`, which Querit support asks for.
|
package/README.md
CHANGED
|
@@ -105,15 +105,26 @@ These are persistent defaults applied to every `web_search` call. They are store
|
|
|
105
105
|
|
|
106
106
|
| Option | Values | Default | Description |
|
|
107
107
|
|---|---|---|---|
|
|
108
|
-
| `count` | `1` – `
|
|
108
|
+
| `count` | `1` – `100` | Querit's server default (left unset) | Number of results per search. Can be overridden per call via the `count` parameter. |
|
|
109
109
|
| `timeRange` | `d7` · `w2` · `m3` · `y1` | *(none — all time)* | Restrict results to the past 7 days, 2 weeks, 3 months, or 1 year. |
|
|
110
|
-
| `includeContent` | `yes` / `no` | `no` | Include sentence-level
|
|
111
|
-
| `chunksPerDoc` | `1` – `3` | API default (`1`) | Content chunks requested per result. This advanced option is configured by editing `querit-search.json`; it is not exposed in the setup wizard. |
|
|
110
|
+
| `includeContent` | `yes` / `no` | `no` | Include sentence-level body text in results for richer context (`needContent`). |
|
|
112
111
|
| `countries` | `argentina` · `australia` · `brazil` · `canada` · `colombia` · `france` · `germany` · `india` · `indonesia` · `japan` · `mexico` · `nigeria` · `philippines` · `south korea` · `spain` · `united kingdom` · `united states` | *(none — global)* | Bias results toward specific countries. Comma-separated, multi-select. |
|
|
113
|
-
| `languages` | `english` · `japanese` · `korean` · `german` · `french` · `spanish` · `portuguese` | *(none — all)* | Filter results by language. Comma-separated, multi-select. |
|
|
112
|
+
| `languages` | `english` · `japanese` · `korean` · `german` · `french` · `spanish` · `portuguese` · `russian` | *(none — all)* | Filter results by language. Comma-separated, multi-select. |
|
|
114
113
|
| `includeDomains` | domain list | *(none — unrestricted)* | **Whitelist** — only these domains return results. |
|
|
115
114
|
| `excludeDomains` | domain list | *(none)* | **Blacklist** — these domains are excluded. Ships with a built-in **Noise blockers** preset: `pinterest.com`, `facebook.com`, `instagram.com`, `tiktok.com`. |
|
|
116
115
|
|
|
116
|
+
#### Advanced options
|
|
117
|
+
|
|
118
|
+
These are set by editing `querit-search.json`; the setup wizard does not prompt for them.
|
|
119
|
+
|
|
120
|
+
| Option | Values | Default | Description |
|
|
121
|
+
|---|---|---|---|
|
|
122
|
+
| `highlights` | `true` / `false` | *(off)* | Ask Querit for query-focused fragments of each page's body text. Usually the best answer to "the snippet is too short", and cheaper to read than whole pages. |
|
|
123
|
+
| `contentMaxChars` | `1` – `1000000` | *(full body text)* | With `includeContent: true`, cap the body text returned per result, in Unicode code points. Ignored otherwise. |
|
|
124
|
+
| `rank` | `relevance` · `freshness` | *(Querit's default ranking)* | A nudge on top of the default ranking, not a sort. Automatically dropped for `vertical: "code"` searches, which reject it. |
|
|
125
|
+
| `needMarkdown` | `true` / `false` | *(off)* | Enterprise plans only: return `snippet_markdown` and `content_markdown`. Querit ignores it on other plans. |
|
|
126
|
+
| `chunksPerDoc` | `1` – `3` | *(off)* | **Deprecated by Querit.** Kept so existing configurations keep working; migrate to `highlights`. Free and PAYG plans support at most `1`. |
|
|
127
|
+
|
|
117
128
|
### Configuration file example
|
|
118
129
|
|
|
119
130
|
```json
|
|
@@ -121,9 +132,10 @@ These are persistent defaults applied to every `web_search` call. They are store
|
|
|
121
132
|
"apiKey": "your-api-key",
|
|
122
133
|
"search": {
|
|
123
134
|
"count": 5,
|
|
124
|
-
"chunksPerDoc": 1,
|
|
125
135
|
"timeRange": "m3",
|
|
126
|
-
"includeContent":
|
|
136
|
+
"includeContent": true,
|
|
137
|
+
"contentMaxChars": 2000,
|
|
138
|
+
"highlights": true,
|
|
127
139
|
"countries": ["united states"],
|
|
128
140
|
"languages": ["english"],
|
|
129
141
|
"includeDomains": ["github.com"],
|
|
@@ -146,11 +158,14 @@ Required:
|
|
|
146
158
|
|
|
147
159
|
Optional:
|
|
148
160
|
|
|
149
|
-
- `count` (`1..
|
|
161
|
+
- `count` (`1..100`) — overrides the configured default for one call
|
|
162
|
+
- `vertical` — `"code"` for programming questions or `"finance"` for markets, listed companies, and macro-economics. Querit routes these to a vertical data source; a mismatched vertical loses results, so leave it out for everything else.
|
|
163
|
+
|
|
164
|
+
Domains, time range, countries, languages, and content detail are persistent defaults configured in `/querit-setup` (stored under `search` in `querit-search.json`), not per-call parameters. Skipping the domain lists leaves search unrestricted; the include list is a whitelist (only those domains return results), the exclude list is a blacklist.
|
|
150
165
|
|
|
151
|
-
|
|
166
|
+
When nothing sets `count`, the extension sends none and Querit applies its server default.
|
|
152
167
|
|
|
153
|
-
Results include explicit title, URL, snippet, source metadata,
|
|
168
|
+
Results include explicit title, URL, snippet, source metadata, optional sentence excerpts, and optional highlights. Duplicate and non-HTTP(S) result URLs are removed. When Querit reports a per-request cost, it is shown on the result line at full precision; an absent cost means unavailable, not free.
|
|
154
169
|
|
|
155
170
|
### `fetch_content`
|
|
156
171
|
|
|
@@ -161,12 +176,17 @@ Optional:
|
|
|
161
176
|
- `format`: `markdown` (default), `text`, or `html`
|
|
162
177
|
- `crawl_timeout`: `1..60` seconds (default `10`)
|
|
163
178
|
- `include_metadata`: default `true`
|
|
179
|
+
- `max_chars` (`1..1000000`) — keep only the beginning of each page. Markup counts, so truncated markdown or HTML can end mid-tag; use `text` for a clean prefix.
|
|
180
|
+
- `highlight_query` — return only the passages relevant to this, extracted from the full page
|
|
181
|
+
- `highlight_max_chars` (`100..8000`) — cap the highlighted characters per URL; Querit picks a length when omitted
|
|
182
|
+
|
|
183
|
+
Both tools mark remote data as untrusted, propagate Pi cancellation, enforce response-size limits, and cap model-visible output at Pi's 50KB/2000-line limit. If formatted output is truncated, the complete output is written to a uniquely named file inside a per-user temp folder (`pi-querit-<uid>` in the OS temp directory), readable only by that user. To keep search content private, that folder never accumulates files: the files a Pi process creates are deleted when that session shuts down (with a process-exit fallback), and leftovers from crashed runs are swept the next time the extension loads.
|
|
164
184
|
|
|
165
|
-
|
|
185
|
+
Failures carry Querit's `search_id`, which its support team uses to trace a request. HTTP 429, 500, and 503 are retried with bounded exponential backoff, honoring `Retry-After`; 400, 401, 403, and 404 are never retried.
|
|
166
186
|
|
|
167
187
|
## Development
|
|
168
188
|
|
|
169
|
-
Requires Node.js 22.19 or newer.
|
|
189
|
+
Requires Node.js 22.19 or newer. Type-checked and tested against Pi 1.6.1.
|
|
170
190
|
|
|
171
191
|
```bash
|
|
172
192
|
npm install
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-querit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Querit web search and content retrieval tools for the Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,13 +22,15 @@
|
|
|
22
22
|
"llm"
|
|
23
23
|
],
|
|
24
24
|
"files": [
|
|
25
|
+
"index.ts",
|
|
25
26
|
"src",
|
|
26
27
|
"README.md",
|
|
28
|
+
"CHANGELOG.md",
|
|
27
29
|
"LICENSE"
|
|
28
30
|
],
|
|
29
31
|
"pi": {
|
|
30
32
|
"extensions": [
|
|
31
|
-
"./
|
|
33
|
+
"./index.ts"
|
|
32
34
|
]
|
|
33
35
|
},
|
|
34
36
|
"scripts": {
|
|
@@ -45,12 +47,12 @@
|
|
|
45
47
|
"typebox": "*"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"@earendil-works/pi-ai": "^
|
|
49
|
-
"@earendil-works/pi-coding-agent": "^
|
|
50
|
-
"@earendil-works/pi-tui": "^
|
|
50
|
+
"@earendil-works/pi-ai": "^1.6.1",
|
|
51
|
+
"@earendil-works/pi-coding-agent": "^1.6.1",
|
|
52
|
+
"@earendil-works/pi-tui": "^1.6.1",
|
|
51
53
|
"@types/node": "^24.0.0",
|
|
52
54
|
"tsx": "^4.20.0",
|
|
53
|
-
"typebox": "
|
|
55
|
+
"typebox": "1.3.27",
|
|
54
56
|
"typescript": "^5.9.0",
|
|
55
57
|
"vitest": "^4.1.0"
|
|
56
58
|
},
|