@zeldrisho/pi-web-search 0.14.1 → 0.14.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 CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.14.2] - 2026-10-28
11
+
12
+ ### Changed
13
+
14
+ - Label generated answers without repeating the search query or fallback notice.
15
+
10
16
  ## [0.14.1] - 2026-10-25
11
17
 
12
18
  ### Changed
@@ -177,7 +183,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
177
183
 
178
184
  - Add bounded Brave web search ([cbc9491](https://github.com/zeldrisho/pi-packages/commit/cbc9491dce36555ab91b6bef203ec8b380596a89))
179
185
 
180
- [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.14.1...HEAD
186
+ [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.14.2...HEAD
187
+ [0.14.2]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.14.1...pi-web-search-v0.14.2
181
188
  [0.14.1]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.14.0...pi-web-search-v0.14.1
182
189
  [0.14.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.13.0...pi-web-search-v0.14.0
183
190
  [0.13.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-search-v0.12.1...pi-web-search-v0.13.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeldrisho/pi-web-search",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Pi extension for bounded Brave web search with generated-answer fallback",
5
5
  "keywords": [
6
6
  "brave-search",
package/src/search.ts CHANGED
@@ -243,7 +243,7 @@ export const webSearchOutputSchema = Type.Object({
243
243
  });
244
244
 
245
245
  /** Generated answers are untrusted claims, not verified facts. */
246
- function formatAnswer(query: string, answer: BraveAnswer): string {
246
+ function formatAnswer(answer: BraveAnswer, fallback: boolean): string {
247
247
  const numbersByUrl = new Map<string, Set<number>>();
248
248
 
249
249
  for (const citation of answer.citations) {
@@ -261,7 +261,7 @@ function formatAnswer(query: string, answer: BraveAnswer): string {
261
261
  .map(([url, numbers]) => `[${[...numbers].join(", ")}] <${url}>`)
262
262
  .join("\n");
263
263
 
264
- const body = `## Answer for ${JSON.stringify(query)}\n\n${answer.text}${sources ? `\n\n### Sources\n${sources}` : ""}`;
264
+ const body = `## ${fallback ? "No web results. AI-generated answer:" : "AI-generated answer:"}\n\n${answer.text}${sources ? `\n\n### Sources\n${sources}` : ""}`;
265
265
 
266
266
  return body;
267
267
  }
@@ -522,7 +522,7 @@ export class SearchRuntime {
522
522
  const results = payload.results.filter((result) => result.url).slice(0, count);
523
523
 
524
524
  const output = payload.answer
525
- ? `${mode === "web" ? "No web results were found. Showing an AI-generated answer instead.\n\n" : ""}${formatAnswer(query, payload.answer)}`
525
+ ? formatAnswer(payload.answer, mode === "web")
526
526
  : formatResults(query, results, count);
527
527
 
528
528
  const truncation = truncateHead(output, {