@zeldrisho/pi-web-fetch 0.3.0 → 0.3.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 ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## [0.3.1](https://github.com/zeldrisho/pi-zeldrova/compare/pi-web-fetch-v0.3.0...pi-web-fetch-v0.3.1) (2026-07-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **web-fetch:** enforce extraction timeout ([aab3828](https://github.com/zeldrisho/pi-zeldrova/commit/aab3828c43459eba761672f7cc104e410cc540cc))
9
+
10
+ ## [0.3.0](https://github.com/zeldrisho/pi-zeldrova/compare/pi-web-fetch-v0.2.0...pi-web-fetch-v0.3.0) (2026-07-20)
11
+
12
+
13
+ ### Features
14
+
15
+ * **web:** Add collapsible web tool results ([e8664d6](https://github.com/zeldrisho/pi-zeldrova/commit/e8664d6c07b719d92f18d9a0048b47cc1970b97c))
16
+
17
+ ## 0.2.0 (2026-07-19)
18
+
19
+
20
+ ### Features
21
+
22
+ * **web-fetch:** Add bounded public page fetching ([b979496](https://github.com/zeldrisho/pi-zeldrova/commit/b979496b32de1cead172ba570307e4a4a7b3421d))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeldrisho/pi-web-fetch",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Pi extension for secure, bounded public web page fetching and Markdown extraction",
5
5
  "keywords": [
6
6
  "pi",
@@ -23,6 +23,7 @@
23
23
  "files": [
24
24
  "src",
25
25
  "README.md",
26
+ "CHANGELOG.md",
26
27
  "LICENSE"
27
28
  ],
28
29
  "type": "module",
package/src/fetch.ts CHANGED
@@ -17,6 +17,7 @@ const FETCH_MAX_REDIRECTS = 5;
17
17
  export interface FetchRemoteDependencies {
18
18
  validateUrl?: (value: string | URL) => Promise<ValidatedTarget>;
19
19
  request?: (target: ValidatedTarget, signal: AbortSignal) => Promise<IncomingMessage>;
20
+ extractHtml?: typeof extractHtmlToMarkdown;
20
21
  timeoutMs?: number;
21
22
  }
22
23
 
@@ -53,6 +54,7 @@ export async function fetchCompleteDocument(
53
54
  const timeoutMs = dependencies.timeoutMs ?? REQUEST_TIMEOUT_MS;
54
55
  const validateUrl = dependencies.validateUrl ?? validateRemoteUrl;
55
56
  const request = dependencies.request ?? requestPinned;
57
+ const extractHtml = dependencies.extractHtml ?? extractHtmlToMarkdown;
56
58
  let timedOut = false;
57
59
  const timeout = setTimeout(() => {
58
60
  timedOut = true;
@@ -107,7 +109,7 @@ export async function fetchCompleteDocument(
107
109
  let title: string | undefined;
108
110
  let extractor: CompleteDocument["extractor"] = "raw";
109
111
  if (contentType === "text/html" || contentType === "application/xhtml+xml") {
110
- const extracted = await extractHtmlToMarkdown(raw, target.url);
112
+ const extracted = await awaitWithAbort(extractHtml(raw, target.url), controller.signal);
111
113
  markdown = extracted.markdown;
112
114
  title = extracted.title;
113
115
  extractor = extracted.extractor;