pi-unsloth-webtools 0.10.0 → 0.10.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.
Files changed (3) hide show
  1. package/README.md +8 -6
  2. package/engines.ts +5 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -56,10 +56,11 @@ Mirrors Unsloth Studio's `web_search` tool:
56
56
  - Sweeps stop as soon as enough results are gathered: engines still in flight are aborted
57
57
  instead of being allowed to run to their timeout.
58
58
  - Engine requests go through the browser-fingerprint transport first (`webFetch.transport`,
59
- default `tls-first`) and fall back to the plain Node transport; a refusal on one transport is
60
- retried on the other. Redirects are followed manually, so every hop is re-checked against the
61
- website policy and private-address literals are refused. When a SOCKS5 proxy is configured the
62
- sweep stays on the plain transport, keeping agent and Tor routing intact.
59
+ default `tls-first`) and fall back to the plain Node transport; a refusal or bot-challenge
60
+ response (such as DuckDuckGo's 202) on one transport is retried on the other. Redirects are
61
+ followed manually, so every hop is re-checked against the website policy and private-address
62
+ literals are refused. When a SOCKS5 proxy is configured the sweep stays on the plain
63
+ transport, keeping agent and Tor routing intact.
63
64
 
64
65
  ### web_fetch
65
66
 
@@ -429,8 +430,9 @@ The suite ports Unsloth Studio's own tests for these tools:
429
430
  - `test/entities.test.ts`: `decodeHtmlEntities` parity with CPython `html.unescape`,
430
431
  legacy refs, longest-prefix rule, Windows-1252 numeric mappings, invalid codepoints
431
432
  - `test/smoke.test.ts`: live network checks against real hosts, including a per-engine
432
- result-health sweep (at least two engines must return well-formed results; engines
433
- that block or reset connections from datacenter IPs count as unhealthy, not failures)
433
+ result-health sweep through the browser-fingerprint transport (at least one engine must
434
+ return well-formed results; engines that block or reset connections from datacenter IPs
435
+ count as unhealthy, not failures)
434
436
 
435
437
  - `test/tls-fetch.test.ts`: the browser-fingerprint transport with a stubbed native module, including
436
438
  transport reuse, body caps, redirect passthrough, and abort/timeout mapping
package/engines.ts CHANGED
@@ -690,8 +690,11 @@ async function httpFetch(
690
690
  attempt = await directEngineHop(targetUrl, headers, method, body, hopSignal);
691
691
  }
692
692
  if (attempt === null) continue;
693
- if (response === null || (attempt.status < 400 && response.status >= 400)) response = attempt;
694
- if (attempt.status < 400) break;
693
+ if (attempt.status === 200 || (attempt.status >= 300 && attempt.status < 400)) {
694
+ response = attempt;
695
+ break;
696
+ }
697
+ if (response === null || response.status >= 400) response = attempt;
695
698
  } catch (err) {
696
699
  const mapped = classifyRequestError(err, caller, hopSignal);
697
700
  if (mapped) throw mapped;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-unsloth-webtools",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "description": "Pi extension: web_search and web_fetch tools that began as a port of the Unsloth Studio codebase and now diverge from it (multi-engine search, opt-in SSRF guard, HTML-to-Markdown extraction)",
6
6
  "main": "index.ts",