@zeldrisho/pi-web-search 0.13.0 → 0.14.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 +9 -1
- package/package.json +1 -1
- package/src/index.ts +17 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.14.0] - 2026-10-25
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Show cache progress and a compact search summary in Pi's tool preview without adding model-facing output.
|
|
15
|
+
- Declare read-only network access hints for permission integrations.
|
|
16
|
+
|
|
10
17
|
## [0.13.0] - 2026-10-24
|
|
11
18
|
|
|
12
19
|
### Added
|
|
@@ -162,7 +169,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
162
169
|
|
|
163
170
|
- Add bounded Brave web search ([cbc9491](https://github.com/zeldrisho/pi-packages/commit/cbc9491dce36555ab91b6bef203ec8b380596a89))
|
|
164
171
|
|
|
165
|
-
[Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.
|
|
172
|
+
[Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.14.0...HEAD
|
|
173
|
+
[0.14.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.13.0...pi-web-search-v0.14.0
|
|
166
174
|
[0.13.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.1...pi-web-search-v0.13.0
|
|
167
175
|
[0.12.1]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.0...pi-web-search-v0.12.1
|
|
168
176
|
[0.12.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.11.0...pi-web-search-v0.12.0
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Text } from "@earendil-works/pi-tui";
|
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { SEARCH_WEB_MAX_QUERY_CHARACTERS } from "./limits";
|
|
5
5
|
import { formatCollapsibleOutput } from "./render";
|
|
6
|
-
import { SearchRuntime, webSearchOutputSchema } from "./search";
|
|
6
|
+
import { SearchRuntime, webSearchOutputSchema, type SearchDetails } from "./search";
|
|
7
7
|
|
|
8
8
|
export { ExpiringLruCache } from "./cache";
|
|
9
9
|
|
|
@@ -43,12 +43,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
43
43
|
const runtime = new SearchRuntime();
|
|
44
44
|
pi.on("session_shutdown", () => runtime.shutdown());
|
|
45
45
|
|
|
46
|
-
pi.registerTool({
|
|
46
|
+
pi.registerTool<typeof webSearchParameters, Partial<SearchDetails>>({
|
|
47
47
|
name: "web_search",
|
|
48
48
|
label: "Web Search",
|
|
49
49
|
description: "Search the web. Use web_fetch to read sources.",
|
|
50
50
|
parameters: webSearchParameters,
|
|
51
51
|
outputSchema: webSearchOutputSchema,
|
|
52
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
52
53
|
|
|
53
54
|
renderCall(args, theme) {
|
|
54
55
|
return new Text(
|
|
@@ -62,14 +63,25 @@ export default function (pi: ExtensionAPI) {
|
|
|
62
63
|
return runtime.execute(params, signal, onUpdate, ctx?.cwd);
|
|
63
64
|
},
|
|
64
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Renders partial text or "Searching…" while pending. Completed text gets a
|
|
68
|
+
* result and cache summary when available and a collapsible body; absent text shows "No results".
|
|
69
|
+
*/
|
|
65
70
|
renderResult(result, { expanded, isPartial }, theme) {
|
|
66
|
-
if (isPartial) return new Text(theme.fg("warning", "Searching…"), 0, 0);
|
|
67
|
-
|
|
68
71
|
const content = result.content.find((item) => item.type === "text");
|
|
69
72
|
|
|
73
|
+
if (isPartial) return new Text(theme.fg("warning", content?.text || "Searching…"), 0, 0);
|
|
74
|
+
|
|
75
|
+
const details = result.details;
|
|
76
|
+
|
|
77
|
+
const summary =
|
|
78
|
+
details?.resultCount !== undefined
|
|
79
|
+
? `${details.answer ? "Generated answer" : `${details.resultCount} results`} · ${details.cached ? "cached" : "miss"}${details.truncated ? " · truncated" : ""}`
|
|
80
|
+
: "";
|
|
81
|
+
|
|
70
82
|
return new Text(
|
|
71
83
|
content?.type === "text"
|
|
72
|
-
? formatCollapsibleOutput(content.text, expanded, theme)
|
|
84
|
+
? `${theme.fg("dim", summary)}${formatCollapsibleOutput(content.text, expanded, theme)}`
|
|
73
85
|
: theme.fg("dim", "No results"),
|
|
74
86
|
0,
|
|
75
87
|
0,
|