pi-web-kit 0.2.3 → 0.2.4

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
@@ -1,13 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## 0.2.3 - 2026-07-17
4
-
5
3
  All notable changes to this project will be documented in this file.
6
4
 
7
5
  This project follows the spirit of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and uses semantic versioning for releases.
8
6
 
9
7
  ## [Unreleased]
10
8
 
9
+ ## [0.2.4] - 2026-07-28
10
+
11
+ ### Changed
12
+
13
+ - Rewrite `library_search`, `library_docs`, `web_search`, and `code_search` prompts so `library_docs` is the default for versioned library/framework/SDK docs (even familiar libraries), `library_search` is reserved for inspecting candidate matches, and `web_search`/`code_search` defer to it. Removes the "ambiguous library" wording that suppressed calls to well-known libraries. The `web_search`/`code_search` deferrals are emitted only when Context7 is configured, so installations without `CONTEXT7_API_KEY` are unaffected. Provider behavior and tool schemas are unchanged.
14
+
15
+ ## [0.2.3] - 2026-07-17
16
+
11
17
  ### Fixed
12
18
 
13
19
  - Honor project-local config only after Pi confirms project trust.
@@ -24,6 +30,10 @@ This project follows the spirit of [Keep a Changelog](https://keepachangelog.com
24
30
 
25
31
  ## [0.2.1] - 2026-06-14
26
32
 
33
+ ### Changed
34
+
35
+ - Simplify provider, configuration, cache, and URL handling while preserving the public tool surface.
36
+
27
37
  ## [0.2.0] - 2026-06-13
28
38
 
29
39
  ### Added
package/README.md CHANGED
@@ -1,20 +1,16 @@
1
1
  # pi-web-kit
2
2
 
3
- Context-efficient web and developer search tools for [Pi](https://pi.dev): `web_search`, `web_fetch`, `library_search`, `library_docs`, and `code_search`.
3
+ Give [Pi](https://pi.dev) current web knowledge, authoritative library docs, and real-world code examples without flooding model context.
4
4
 
5
- `pi-web-kit` provides provider-backed search, page fetching, library docs lookup, and code-context search with bounded output, chunked reads, URL validation, and an in-memory fetch cache designed for agent workflows.
5
+ `pi-web-kit` combines search, page reading, version-aware documentation, and code research behind five agent-ready tools with bounded, cache-aware output.
6
6
 
7
7
  ## Features
8
8
 
9
- - `web_search` for current/external web information, including multi-query searches.
10
- - `web_fetch` for reading one or more URLs, with `offset` / `limit` chunk reads for long pages.
11
- - `library_search` and `library_docs` for library resolution and current, version-aware documentation/code examples.
12
- - `code_search` for practical examples and implementation context.
13
- - Multiple provider backends: Exa MCP, Exa API, TinyFish, Brave Search, Firecrawl, markdown.new, Context7, and Exa Code.
14
- - Provider-tailored tool schemas at Pi startup/reload.
15
- - URL validation: HTTP(S)-only, no embedded credentials, fragment stripping, duplicate removal, and length/count limits.
16
- - In-memory fetch cache with TTL, LRU eviction, max entry count, max byte count, and cache keys based on provider/config/fetch-affecting options.
17
- - Bounded provider concurrency and network timeouts.
9
+ - **Research the live web** — search current information and read single or multiple pages without leaving Pi.
10
+ - **Use docs that match the task** — resolve libraries and retrieve focused, version-aware documentation with code examples.
11
+ - **Find proven implementation patterns** — search practical usage, setup, migrations, and error context across real code.
12
+ - **Spend context wisely** — compact search results, chunked page reads, bounded output, and fetch caching keep research useful without overwhelming the model.
13
+ - **Choose your providers** — mix Exa, TinyFish, Brave, Firecrawl, markdown.new, Context7, and Exa Code based on coverage, cost, and credentials.
18
14
 
19
15
  ## Installation
20
16
 
@@ -38,8 +38,17 @@ function registerTools(pi: ExtensionAPI, startupConfig: ReturnType<typeof resolv
38
38
  name: "web_search",
39
39
  label: "Web Search",
40
40
  description: buildSearchDescription(startupConfig.provider_search),
41
- promptSnippet: "Find current or external web information.",
42
- promptGuidelines: ["Use web_search to find current or external web information."],
41
+ promptSnippet: startupConfig.apiKeys.context7
42
+ ? "Search the live web for current events, news, and non-library topics."
43
+ : "Find current or external web information.",
44
+ promptGuidelines: [
45
+ startupConfig.apiKeys.context7
46
+ ? "Use web_search for current events, news, and non-library topics."
47
+ : "Use web_search to find current or external web information.",
48
+ ...(startupConfig.apiKeys.context7
49
+ ? ["Prefer library_docs over web_search for versioned library/framework/SDK documentation."]
50
+ : []),
51
+ ],
43
52
  parameters: buildSearchSchema(startupConfig.provider_search),
44
53
  async execute(_toolCallId, rawParams, signal, onUpdate, ctx) {
45
54
  const params = rawParams as Record<string, any>;
@@ -108,9 +117,9 @@ function registerTools(pi: ExtensionAPI, startupConfig: ReturnType<typeof resolv
108
117
  pi.registerTool({
109
118
  name: "library_search",
110
119
  label: "Library Search",
111
- description: "Resolve library, package, framework, SDK, API, or CLI names to canonical library IDs.",
112
- promptSnippet: "Resolve a library name to a canonical library ID before querying docs.",
113
- promptGuidelines: ["Use library_search when a library/framework/package is ambiguous or you need a canonical library ID."],
120
+ description: "Resolve library, package, framework, SDK, API, or CLI names to canonical library IDs with version, trust, and snippet metadata. Use when you need to inspect candidate matches (official sources, versions, forks); library_docs resolves names automatically.",
121
+ promptSnippet: "List candidate library IDs; library_docs resolves names on its own.",
122
+ promptGuidelines: ["Use library_search only to inspect matching libraries (official source, versions, forks) before a precise library_docs call.", "Not needed for ordinary doc lookups — library_docs resolves a libraryName for you."],
114
123
  parameters: buildLibrarySearchSchema(),
115
124
  async execute(_toolCallId, rawParams, signal, _onUpdate, ctx) {
116
125
  const params = rawParams as Record<string, any>;
@@ -126,9 +135,9 @@ function registerTools(pi: ExtensionAPI, startupConfig: ReturnType<typeof resolv
126
135
  pi.registerTool({
127
136
  name: "library_docs",
128
137
  label: "Library Docs",
129
- description: "Fetch current, version-aware documentation and code examples for a library.",
130
- promptSnippet: "Get current library documentation and code examples.",
131
- promptGuidelines: ["Use library_docs for current APIs, framework behavior, SDK examples, package docs, and version-specific library questions."],
138
+ description: "Fetch current, version-aware documentation and code examples for a library. Pass libraryName to resolve it automatically, or a known libraryId.",
139
+ promptSnippet: "Get current, version-aware library/framework/SDK docs and code examples.",
140
+ promptGuidelines: ["Use library_docs for any library, framework, SDK, API, or CLI — even familiar ones like React, Next.js, Prisma, or Express. Training data may be outdated; this returns version-specific docs.", "Prefer library_docs over web_search or your own knowledge for library/API questions. Pass libraryName and query; you rarely need library_search first."],
132
141
  parameters: buildLibraryDocsSchema(),
133
142
  async execute(_toolCallId, rawParams, signal, _onUpdate, ctx) {
134
143
  const params = rawParams as Record<string, any>;
@@ -154,7 +163,10 @@ function registerTools(pi: ExtensionAPI, startupConfig: ReturnType<typeof resolv
154
163
  label: "Code Search",
155
164
  description: "Find practical code examples, usage patterns, setup snippets, migrations, and error context.",
156
165
  promptSnippet: "Find real-world code examples, usage patterns, migrations, and error context.",
157
- promptGuidelines: ["Use code_search for real-world code examples, GitHub/open-source usage patterns, API syntax examples, setup snippets, migrations, and error messages."],
166
+ promptGuidelines: [
167
+ "Use code_search for real-world code examples, usage patterns, setup snippets, migrations, and error context from open source.",
168
+ ...(startupConfig.apiKeys.context7 ? ["Prefer library_docs for official API/reference documentation."] : []),
169
+ ],
158
170
  parameters: buildCodeSearchSchema(),
159
171
  async execute(_toolCallId, rawParams, signal, _onUpdate, ctx) {
160
172
  const params = rawParams as Record<string, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-kit",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Context-efficient web search and fetch tools for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,13 +58,13 @@
58
58
  "typebox": "*"
59
59
  },
60
60
  "devDependencies": {
61
- "@earendil-works/pi-ai": "^0.80.0",
62
- "@earendil-works/pi-coding-agent": "^0.80.0",
63
- "@earendil-works/pi-tui": "^0.80.0",
64
- "@types/node": "^26.1.0",
65
- "tsx": "^4.23.0",
66
- "typebox": "^1.3.4",
67
- "typescript": "^6.0.3"
61
+ "@earendil-works/pi-ai": "^0.80.10",
62
+ "@earendil-works/pi-coding-agent": "^0.80.10",
63
+ "@earendil-works/pi-tui": "^0.80.10",
64
+ "@types/node": "^26.1.1",
65
+ "tsx": "^4.23.1",
66
+ "typebox": "^1.3.6",
67
+ "typescript": "^7.0.2"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"