@bacnh85/pi-web 0.5.4 → 0.5.6

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,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to `pi-web` will be documented in this file.
4
+
5
+ ## 0.5.6 (2026-08-01)
6
+
7
+ ### Features
8
+
9
+ - **Portable instructions:** pi-web now self-injects its backend-selection routing guidance via a gated `before_agent_start` hook (fires only when a `web_*` tool is active). This guidance previously lived in the global `~/.pi/agent/AGENTS.md`; moving it here makes it travel with the package and carry zero overhead when pi-web is absent. Per-tool `promptGuidelines` are unchanged.
10
+
11
+ ## 0.5.5 (2026-07-30)
12
+
13
+ ### Improvements
14
+
15
+ - Patch version bump for release sync and package documentation update.
16
+
17
+ ## 0.5.4 (2026-07-24)
18
+
19
+ ### Fixes
20
+
21
+ - Fixed best-effort error handling for `web_extract` and improved fallback reporting across search and extraction modules.
22
+
23
+ ## 0.5.3 (2026-07-20)
24
+
25
+ ### Features
26
+
27
+ - Support Pi 0.82.0 ESM extension loading.
28
+
29
+ ## 0.4.0 (2026-07-10)
30
+
31
+ ### Features
32
+
33
+ - Consolidated 14 backend-specific tools into 7 unified tools (`web_search`, `web_extract`, `web_map`, `web_crawl`, `web_screenshot`, `web_pdf`, `web_status`).
34
+ - Auto-selection and adaptive fallback between static (JSDOM), dynamic (Firecrawl), and full (Crawl4AI) backends.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # pi-web v0.5
1
+ # @bacnh85/pi-web
2
2
 
3
3
  Pi extension for **unified web search, content extraction, site crawling, and page capture**.
4
4
 
@@ -10,14 +10,6 @@ Auto-selects the best backend from SearXNG (self-hosted), Brave Search, Firecraw
10
10
  pi install npm:@bacnh85/pi-web
11
11
  ```
12
12
 
13
- From this repository:
14
-
15
- ```bash
16
- pi install ./extensions/pi-web
17
- # or test directly
18
- pi -e ./extensions/pi-web
19
- ```
20
-
21
13
  ## Configuration
22
14
 
23
15
  Environment lookup order:
@@ -45,6 +37,10 @@ Variables:
45
37
 
46
38
  Secrets are never printed; `web_status` reports only presence/source.
47
39
 
40
+ ### Always-on routing guidance
41
+
42
+ When any `web_*` tool is active, pi-web injects a condensed backend-selection protocol (SearXNG → Brave → Firecrawl ordering, Firecrawl precision/scrape caveats, source-citation rule) into the system prompt via a `before_agent_start` hook. This travels with the package — no edits to `~/.pi/agent/AGENTS.md` are required — and carries zero overhead when pi-web is not loaded.
43
+
48
44
  ## Tools
49
45
 
50
46
  ### `web_search` — Unified search
@@ -218,6 +214,10 @@ v0.4 replaces the 14 individual backend-specific tools with 7 unified tools:
218
214
 
219
215
  All v0.3 tool names were removed in v0.4. Update any agent instructions or skills that reference the old names.
220
216
 
217
+ ## Changelog
218
+
219
+ See [CHANGELOG.md](CHANGELOG.md) for release history.
220
+
221
221
  ## Development
222
222
 
223
223
  ```bash
@@ -48,6 +48,35 @@ const crawl4aiControlSchema = {
48
48
  crawl4ai_api_token: Type.Optional(Type.String({ description: "Override $CRAWL4AI_API_TOKEN." })),
49
49
  };
50
50
 
51
+ // ---------------------------------------------------------------------------
52
+ // Always-on routing guidance (injected only when a web_* tool is active)
53
+ // ---------------------------------------------------------------------------
54
+
55
+ // Portable home for the pi-web backend-selection protocol. Previously forced
56
+ // always-on via ~/.pi/agent/AGENTS.md; now self-injected by this extension so
57
+ // the guidance travels with the package and disappears when pi-web is absent.
58
+ const WEB_ROUTING_GUIDANCE = `## Web Tool Routing (pi-web)
59
+
60
+ The pi-web extension provides 7 unified tools that auto-select the best backend:
61
+
62
+ - **\`web_search\`** — Search the web (auto: SearXNG → Brave → Firecrawl). Use
63
+ \`backend\` for explicit control, \`engines\` for SearXNG tuning.
64
+ - **\`web_extract\`** — Extract readable content from a URL (auto: static JSDOM
65
+ → dynamic Firecrawl → full Crawl4AI). Use \`mode\` for explicit control.
66
+ - **\`web_map\`** — Discover URLs from a site (Firecrawl Map).
67
+ - **\`web_crawl\`** — Crawl multiple pages. \`mode: "light"\` (Firecrawl) or
68
+ \`mode: "full"\` (Crawl4AI).
69
+ - **\`web_screenshot\`** / **\`web_pdf\`** — Visual/page capture (Crawl4AI).
70
+ - **\`web_status\`** — Check provider configuration and server health.
71
+
72
+ Backend selection rules:
73
+
74
+ - Firecrawl Search has poor semantic accuracy on domain-specific queries; prefer
75
+ SearXNG or Brave for precision (force via \`backend\`).
76
+ - Firecrawl Scrape fails on bot-protected sites (e.g. Ansible docs); Crawl4AI
77
+ handles those (force via \`mode: "full"\`).
78
+ - Always cite source URLs when web results materially support an answer.`;
79
+
51
80
 
52
81
  // ---------------------------------------------------------------------------
53
82
  // Extension entry point
@@ -414,4 +443,13 @@ export default function piWebExtension(pi: ExtensionAPI) {
414
443
  },
415
444
  });
416
445
 
446
+ // ── Always-on routing guidance ──────────────────────────────────────────
447
+ // Inject the backend-selection protocol only when a web_* tool is actually
448
+ // active, so recon agents / sessions without pi-web carry zero overhead.
449
+ pi.on("before_agent_start", async (event) => {
450
+ const active = event.systemPromptOptions?.selectedTools ?? [];
451
+ if (!active.some((t) => t.startsWith("web_"))) return;
452
+ return { systemPrompt: `${event.systemPrompt}\n\n${WEB_ROUTING_GUIDANCE}` };
453
+ });
454
+
417
455
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bacnh85/pi-web",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Pi extension for web search, page extraction, Firecrawl scraping/crawling, and Crawl4AI headless browser crawling.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "files": [
30
30
  "README.md",
31
+ "CHANGELOG.md",
31
32
  "extensions/index.ts",
32
33
  "extensions/lib/",
33
34
  "extensions/types.d.ts",