@zeldrisho/pi-web-fetch 0.11.0 → 0.11.1

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,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.1] - 2026-10-20
11
+
12
+ ### Changed
13
+
14
+ - Simplify the model-facing fetch tool and parameter descriptions.
15
+
16
+ ### Fixed
17
+
18
+ - Retry 404 and 406 responses to Markdown-negotiated requests with HTML preferred, allowing pages whose HTML representation is available to fetch successfully.
19
+
10
20
  ## [0.11.0] - 2026-10-19
11
21
 
12
22
  ### Added
@@ -223,7 +233,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
223
233
 
224
234
  - Add bounded public page fetching ([b979496](https://github.com/zeldrisho/pi-packages/commit/b979496b32de1cead172ba570307e4a4a7b3421d))
225
235
 
226
- [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.11.0...HEAD
236
+ [Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.11.1...HEAD
237
+ [0.11.1]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.11.0...pi-web-fetch-v0.11.1
227
238
  [0.11.0]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.10.2...pi-web-fetch-v0.11.0
228
239
  [0.10.2]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.10.1...pi-web-fetch-v0.10.2
229
240
  [0.10.1]: https://github.com/zeldrisho/pi-packages/compare/pi-web-fetch-v0.10.0...pi-web-fetch-v0.10.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeldrisho/pi-web-fetch",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Pi extension for secure, bounded public web page fetching and Markdown extraction",
5
5
  "keywords": [
6
6
  "pi",
@@ -478,13 +478,29 @@ async function fetchDocument(
478
478
  };
479
479
 
480
480
  try {
481
+ const requestUrl = normalizeGitHubRawUrl(rawUrl);
482
+
481
483
  let { target, response } = await requestFollowingRedirects(
482
- normalizeGitHubRawUrl(rawUrl),
484
+ requestUrl,
483
485
  controller.signal,
484
486
  requestDependencies,
485
487
  conditionalHeaders,
486
488
  );
487
489
 
490
+ // Some servers route Markdown negotiation to a missing representation even
491
+ // though their HTML page exists (for example, Redis documentation URLs).
492
+ // Retry only these representation-related statuses, through the same
493
+ // validated redirect/network boundary, with HTML preferred.
494
+ if ([404, 406].includes(response.statusCode ?? 0)) {
495
+ response.resume();
496
+ ({ target, response } = await requestFollowingRedirects(
497
+ target.url,
498
+ controller.signal,
499
+ requestDependencies,
500
+ { Accept: "text/html, text/plain;q=0.9, */*;q=0.1" },
501
+ ));
502
+ }
503
+
488
504
  if (
489
505
  response.statusCode !== undefined &&
490
506
  responseHeader(response, "cf-mitigated")?.trim().toLowerCase() === "challenge"
package/src/index.ts CHANGED
@@ -61,10 +61,8 @@ export {
61
61
 
62
62
  export const webFetchParameters = Type.Object({
63
63
  url: Type.String(),
64
- query: Type.Optional(Type.String({ description: "Return only matching sections (long pages)." })),
65
- offset: Type.Optional(
66
- Type.Integer({ description: "Character offset; use nextOffset to continue." }),
67
- ),
64
+ query: Type.Optional(Type.String({ description: "Find sections matching this text." })),
65
+ offset: Type.Optional(Type.Integer({ description: "Start at this character offset." })),
68
66
  });
69
67
 
70
68
  /**
@@ -80,7 +78,7 @@ export default function (pi: ExtensionAPI) {
80
78
  pi.registerTool({
81
79
  name: "web_fetch",
82
80
  label: "Web Fetch",
83
- description: "Fetch a public HTTP(S) page as Markdown (6,000 chars per call).",
81
+ description: "Read a public webpage as Markdown.",
84
82
  parameters: webFetchParameters,
85
83
 
86
84
  renderCall(args, theme) {