@zeldrisho/pi-web-search 0.4.1 → 0.4.2
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 +12 -0
- package/README.md +1 -1
- package/package.json +4 -4
- package/src/index.ts +13 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [0.4.2](https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.4.1...pi-web-search-v0.4.2) (2026-08-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug fixes
|
|
6
|
+
|
|
7
|
+
- **web-search:** Emit provider-compatible object schema for tool parameters ([fe81916](https://github.com/zeldrisho/pi-packages/commit/fe819161e9cf61be09a0d68be713b63cb318155e))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
- **web-search:** Document runtime enforcement of the context query limit ([347b386](https://github.com/zeldrisho/pi-packages/commit/347b386c62f33d489b6be207aff2a96f491eced0))
|
|
13
|
+
|
|
2
14
|
## [0.4.1](https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.4.0...pi-web-search-v0.4.1) (2026-08-03)
|
|
3
15
|
|
|
4
16
|
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ If Pi is already running when you set the environment variable, run `/reload` in
|
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
|
-
The `web_search` tool returns compact web results by default, making it suitable for discovering current sources and URLs. Set `mode` to `context` to call only Brave's LLM Context API and return provider-extracted snippets. Context queries are limited to 400 characters; web-mode queries are limited to 500 characters.
|
|
30
|
+
The `web_search` tool returns compact web results by default, making it suitable for discovering current sources and URLs. Set `mode` to `context` to call only Brave's LLM Context API and return provider-extracted snippets. Context queries are limited to 400 characters; web-mode queries are limited to 500 characters. Because the provider rejects union schemas, the tool schema accepts up to the web-mode query length for either mode; the tighter context-mode limit is enforced at runtime when the request executes, not in the schema.
|
|
31
31
|
|
|
32
32
|
Context snippets may not reflect the current live page. The tool does not fetch result URLs. When live-page inspection is needed, call `web_fetch` explicitly on the relevant URL.
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeldrisho/pi-web-search",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Pi extension for bounded Brave web search and LLM context retrieval",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"brave-search",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@earendil-works/pi-ai": "^0.
|
|
36
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
37
|
-
"@earendil-works/pi-tui": "^0.
|
|
35
|
+
"@earendil-works/pi-ai": "^0.83.0",
|
|
36
|
+
"@earendil-works/pi-coding-agent": "^0.83.0",
|
|
37
|
+
"@earendil-works/pi-tui": "^0.83.0",
|
|
38
38
|
"typebox": "^1.1.24",
|
|
39
39
|
"typescript": "^5.0.0",
|
|
40
40
|
"vite-plus": "0.2.5"
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,19 @@ export {
|
|
|
22
22
|
type SearchTruncationDetails,
|
|
23
23
|
} from "./search";
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
export const webSearchParameters = Type.Object({
|
|
26
|
+
query: Type.String({
|
|
27
|
+
minLength: 1,
|
|
28
|
+
maxLength: SEARCH_WEB_MAX_QUERY_CHARACTERS,
|
|
29
|
+
description: `The search query (maximum ${SEARCH_WEB_MAX_QUERY_CHARACTERS} characters; context mode limited to ${SEARCH_CONTEXT_MAX_QUERY_CHARACTERS})`,
|
|
30
|
+
}),
|
|
31
|
+
mode: Type.Optional(
|
|
32
|
+
StringEnum(["web", "context"] as const, {
|
|
33
|
+
description:
|
|
34
|
+
"Search mode: compact Brave web results (default) or Brave LLM context extraction",
|
|
35
|
+
default: "web",
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
26
38
|
count: Type.Optional(
|
|
27
39
|
Type.Integer({
|
|
28
40
|
minimum: SEARCH_MIN_RESULT_COUNT,
|
|
@@ -44,32 +56,6 @@ const commonSearchParameters = Type.Object({
|
|
|
44
56
|
),
|
|
45
57
|
});
|
|
46
58
|
|
|
47
|
-
export const webSearchParameters = Type.Intersect([
|
|
48
|
-
commonSearchParameters,
|
|
49
|
-
Type.Union([
|
|
50
|
-
Type.Object({
|
|
51
|
-
query: Type.String({
|
|
52
|
-
minLength: 1,
|
|
53
|
-
maxLength: SEARCH_CONTEXT_MAX_QUERY_CHARACTERS,
|
|
54
|
-
description: `The Brave LLM Context query (maximum ${SEARCH_CONTEXT_MAX_QUERY_CHARACTERS} characters)`,
|
|
55
|
-
}),
|
|
56
|
-
mode: Type.Literal("context", {
|
|
57
|
-
description: "Return provider-extracted Brave LLM context",
|
|
58
|
-
}),
|
|
59
|
-
}),
|
|
60
|
-
Type.Object({
|
|
61
|
-
query: Type.String({
|
|
62
|
-
minLength: 1,
|
|
63
|
-
maxLength: SEARCH_WEB_MAX_QUERY_CHARACTERS,
|
|
64
|
-
description: `The web search query (maximum ${SEARCH_WEB_MAX_QUERY_CHARACTERS} characters)`,
|
|
65
|
-
}),
|
|
66
|
-
mode: Type.Optional(
|
|
67
|
-
Type.Literal("web", { description: "Return compact Brave web results (default)" }),
|
|
68
|
-
),
|
|
69
|
-
}),
|
|
70
|
-
]),
|
|
71
|
-
]);
|
|
72
|
-
|
|
73
59
|
export default function (pi: ExtensionAPI) {
|
|
74
60
|
const runtime = new SearchRuntime();
|
|
75
61
|
pi.on("session_shutdown", () => runtime.shutdown());
|